Skip to content

Retest develop-ubuntu-2204-slim-primary #1

Retest develop-ubuntu-2204-slim-primary

Retest develop-ubuntu-2204-slim-primary #1

name: Retest develop-ubuntu-2204-slim-primary
on:
workflow_dispatch:
schedule:
- cron: '00 13 * * *' # utc
jobs:
develop-ubuntu-2204-slim-primary:
runs-on: self-hosted
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
# NOTE(mikal): git repos are checked out to /srv/github/_work/{repo}/{repo}
# which is available as GITHUB_WORKSPACE. You can find other environment
# variables at https://docs.github.com/en/actions/learn-github-actions/environment-variables
steps:
- name: Set environment variables
run: |
echo "SF_HEAD_SHA=${{ github.event.pull_request.head.sha }}" >> $GITHUB_ENV
echo "SF_PRIMARY_REPO=$( echo ${{ github.repository }} | cut -f 2 -d '/' )" >> $GITHUB_ENV
echo "SHAKENFIST_NAMESPACE=$(hostname)" >> $GITHUB_ENV
- name: Checkout shakenfist
uses: actions/checkout@v4
with:
path: shakenfist
fetch-depth: 0
ref: develop
- name: Determine if there is any dependency between the repositories
run: |
python3 ${GITHUB_WORKSPACE}/shakenfist/tools/clone_with_depends.py
- name: Build infrastructure
run: |
cd ${GITHUB_WORKSPACE}/shakenfist
ansible-playbook -i /home/debian/ansible-hosts \
--extra-vars "identifier=${SHAKENFIST_NAMESPACE} source_path=${GITHUB_WORKSPACE} \
base_image=sf://label/ci-images/ubuntu-2204 base_image_user=ubuntu" \
deploy/ansible/ci-topology-slim-primary.yml
- name: Copy CI tools to primary
run: |
. ${GITHUB_WORKSPACE}/ci-environment.sh
cd ${GITHUB_WORKSPACE}/shakenfist
scp -i /srv/github/id_ci -o StrictHostKeyChecking=no \
-o UserKnownHostsFile=/dev/null -rp tools \
ubuntu@$primary:.
- name: Log github actions buffering status
run: |
. ${GITHUB_WORKSPACE}/ci-environment.sh
cd ${GITHUB_WORKSPACE}/shakenfist
tools/run_remote ${primary} python3 tools/buffer.py
- name: Run getsf installer on primary
run: |
. ${GITHUB_WORKSPACE}/ci-environment.sh
ssh -i /srv/github/id_ci -o StrictHostKeyChecking=no \
-o UserKnownHostsFile=/dev/null \
ubuntu@$primary /tmp/getsf-wrapper
echo ""
echo ""
ssh -i /srv/github/id_ci -o StrictHostKeyChecking=no \
-o UserKnownHostsFile=/dev/null \
ubuntu@$primary \
'sudo rm /etc/apache2/sites-enabled/*; sudo a2ensite sf-example.conf; sudo apachectl graceful'
- name: Wait for API to start answering
run: |
set +e
. ${GITHUB_WORKSPACE}/ci-environment.sh
ssh -i /srv/github/id_ci -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null \
ubuntu@$primary 'sudo chmod ugo+r /etc/sf/* /var/log/syslog'
count=0
while [ $count -lt 60 ]
do
ssh -i /srv/github/id_ci -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null \
ubuntu@$primary '. /etc/sf/sfrc; sf-client instance list'
if [ $? == 0 ]; then
exit 0
fi
count=$(( $count + 1 ))
sleep 5
done
exit 1
- name: Import cached images (v0.6+)
if: true
run: |
. ${GITHUB_WORKSPACE}/ci-environment.sh
ssh -i /srv/github/id_ci -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null \
ubuntu@$primary \
'. /etc/sf/sfrc; sf-client artifact upload ubuntu-1804 /srv/ci/ubuntu:18.04 --shared'
ssh -i /srv/github/id_ci -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null \
ubuntu@$primary \
'. /etc/sf/sfrc; sf-client artifact upload ubuntu-2004 /srv/ci/ubuntu:20.04 --shared'
ssh -i /srv/github/id_ci -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null \
ubuntu@$primary \
'. /etc/sf/sfrc; sf-client artifact upload debian-11 /srv/ci/debian:11 --shared'
ssh -i /srv/github/id_ci -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null \
ubuntu@$primary \
'. /etc/sf/sfrc; sf-client artifact upload cirros /srv/ci/cirros --shared'
# It turns out that scheduled tests for other branches still use the workflow from develop, so
# this version must handle all of those branches
- name: Import cached images (v0.5)
if: false
run: |
. ${GITHUB_WORKSPACE}/ci-environment.sh
ssh -i /srv/github/id_ci -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null \
ubuntu@$primary \
'. /etc/sf/sfrc; sf-client artifact upload ubuntu-1804 /srv/ci/ubuntu:18.04'
ssh -i /srv/github/id_ci -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null \
ubuntu@$primary \
'. /etc/sf/sfrc; sf-client artifact upload ubuntu-2004 /srv/ci/ubuntu:20.04'
ssh -i /srv/github/id_ci -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null \
ubuntu@$primary \
'. /etc/sf/sfrc; sf-client artifact upload debian-11 /srv/ci/debian:11'
ssh -i /srv/github/id_ci -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null \
ubuntu@$primary \
'. /etc/sf/sfrc; sf-client artifact upload cirros /srv/ci/cirros'
- name: Create a base level of activity in the cluster
run: |
. ${GITHUB_WORKSPACE}/ci-environment.sh
ssh -i /srv/github/id_ci -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null \
ubuntu@$primary \
'echo "==== sfrc ===="; cat /etc/sf/sfrc; echo "==== end sfrc ===="'
echo ""
echo ""
ssh -i /srv/github/id_ci -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null \
ubuntu@$primary \
'. /etc/sf/sfrc; for i in `seq 100`; do sf-client --async=continue network create background-$i 10.$i.0.0/24 > /dev/null; echo -n "."; done'
echo ""
- name: Run functional tests
timeout-minutes: 120
run: |
. ${GITHUB_WORKSPACE}/ci-environment.sh
scp -rp -i /srv/github/id_ci -o StrictHostKeyChecking=no \
-o UserKnownHostsFile=/dev/null \
$source_path/shakenfist \
ubuntu@$primary:shakenfist
ssh -i /srv/github/id_ci -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null \
ubuntu@$primary "cd shakenfist/deploy; . /etc/sf/sfrc; sudo PIP_BREAK_SYSTEM_PACKAGES=1 pip3 install -r requirements.txt; set -e; stestr run --concurrency=5; stestr slowest"
- name: Check logs
if: always()
run: |
. ${GITHUB_WORKSPACE}/ci-environment.sh
cd ${GITHUB_WORKSPACE}/shakenfist
tools/run_remote ${primary} sudo /home/${baseuser}/tools/ci_event_checks.sh
# On Ubuntu 22.04 the cleaner is rated a CPU hog because of etcd cleanup
# cost. That's not really something we can control, so just ignore the CPU
# usage of that process instead.
- name: Check SF process CPU usage
if: always()
run: |
. ${GITHUB_WORKSPACE}/ci-environment.sh
ssh -i /srv/github/id_ci -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null \
ubuntu@$primary '. /etc/sf/sfrc; sf-client node cpuhogs --ignore sf_cleaner'
- name: Check for reasonable data rates
timeout-minutes: 5
if: always()
run: |
. ${GITHUB_WORKSPACE}/ci-environment.sh
cd ${GITHUB_WORKSPACE}/shakenfist
tools/run_remote ${primary} sudo /home/${baseuser}/tools/ci_event_checks.sh
- name: Fetch and tweak inventory
if: always()
run: |
. ${GITHUB_WORKSPACE}/ci-environment.sh
scp -i /srv/github/id_ci -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null \
ubuntu@$primary:/etc/sf/inventory.yaml /srv/github/
sed -i 's|/root/.ssh|/home/debian/.ssh|g' /srv/github/inventory.yaml
echo "====="
cat /srv/github/inventory.yaml
- name: Gather logs
if: always()
run: |
set -x
. ${GITHUB_WORKSPACE}/ci-environment.sh
# We need the ssh key in the place ansible expects it to be, which isn't
# true on the CI worker node.
cp /srv/github/id_ci /home/debian/.ssh/id_rsa
cp /srv/github/id_ci.pub /home/debian/.ssh/id_rsa.pub
scp -i /srv/github/id_ci -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null \
ubuntu@$primary:/etc/sf/inventory.yaml /srv/github/
ansible-playbook -i /srv/github/inventory.yaml \
--extra-vars "base_image_user=ubuntu ansible_ssh_common_args='-o StrictHostKeyChecking=no'" \
${GITHUB_WORKSPACE}/shakenfist/deploy/ansible/ci-gather-logs.yml
- uses: actions/upload-artifact@v4
if: always()
with:
name: bundle.zip
retention-days: 90
if-no-files-found: error
path: /srv/github/artifacts/bundle.zip
- name: Snapshot localhost builds for later upgrade testing
if: success()
run: |
if [ $(echo "slim-primary" | grep -c "localhost") -gt 1 ]; then
base=$(echo "sf://label/ci-images/ubuntu-2204" | cut -f 5 -d "/")
sf-client instance snapshot primary \
--label_name ci-images/$base-$GITHUB_BASE_REF \
--delete-snapshot-after-label --flatten
fi
- uses: JasonEtco/create-an-issue@v2
if: failure()
id: create-issue
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SF_CI_NAME: develop-ubuntu-2204-slim-primary
SF_BRANCH: develop
SF_ACTION_RUN: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
with:
filename: shakenfist/.github/workflows/scheduled-tests-failure.md
update_existing: true
search_existing: open
- if: failure()
run: 'echo Created ${{ steps.create-issue.outputs.url }}'