Skip to content

Commit dbf3508

Browse files
committed
CI: Run container image build job on ARC cluster
The Actions Runner Controller (ARC) cluster runs GitHub Actions jobs on a Kubernetes cluster. This allows us to dynamically provision resources for our CI workflows. This change switches the container image build jobs to use the ARC cluster. The job now runs in a container, with access to a Docker in Docker container for building images. This allows us to skip the host configuration part of the workflow. See https://github.com/stackhpc/ARC-Installer/
1 parent af73161 commit dbf3508

File tree

2 files changed

+22
-49
lines changed

2 files changed

+22
-49
lines changed

.github/workflows/stackhpc-all-in-one.yml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -290,8 +290,3 @@ jobs:
290290
OS_APPLICATION_CREDENTIAL_ID: ${{ secrets.OS_APPLICATION_CREDENTIAL_ID }}
291291
OS_APPLICATION_CREDENTIAL_SECRET: ${{ secrets.OS_APPLICATION_CREDENTIAL_SECRET }}
292292
if: always()
293-
294-
- name: Prune Docker images over 1 week old
295-
# May fail if another prune is running
296-
run: docker image prune --all --force --filter until=168h || true
297-
if: always()

.github/workflows/stackhpc-container-image-build.yml

Lines changed: 22 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ jobs:
4545
generate-tag:
4646
name: Generate container image tag
4747
if: github.repository == 'stackhpc/stackhpc-kayobe-config'
48-
runs-on: [self-hosted, stackhpc-kayobe-config-kolla-builder]
48+
runs-on: ubuntu-latest
4949
permissions: {}
5050
outputs:
5151
kolla_tag: ${{ steps.kolla_tag.outputs.kolla_tag }}
@@ -97,7 +97,7 @@ jobs:
9797
container-image-build:
9898
name: Build Kolla container images
9999
if: github.repository == 'stackhpc/stackhpc-kayobe-config'
100-
runs-on: [self-hosted, stackhpc-kayobe-config-kolla-builder]
100+
runs-on: arc-skc-container-image-builder-runner
101101
timeout-minutes: 720
102102
permissions: {}
103103
strategy:
@@ -106,7 +106,13 @@ jobs:
106106
needs:
107107
- generate-tag
108108
steps:
109-
- uses: actions/checkout@v4
109+
- name: Install package dependencies
110+
run: |
111+
sudo apt update
112+
sudo apt install -y build-essential git unzip nodejs python3-wheel python3-pip python3-venv
113+
114+
- name: Checkout
115+
uses: actions/checkout@v4
110116
with:
111117
path: src/kayobe-config
112118

@@ -117,33 +123,9 @@ jobs:
117123
ref: refs/heads/stackhpc/${{ needs.generate-tag.outputs.openstack_release }}
118124
path: src/kayobe
119125

120-
# FIXME: Failed in kolla-ansible : Ensure the latest version of pip is installed
121-
- name: Install dependencies
126+
- name: Make sure dockerd is running and test Docker
122127
run: |
123-
sudo dnf -y install python3-virtualenv
124-
125-
- name: Setup networking
126-
run: |
127-
if ! ip l show breth1 >/dev/null 2>&1; then
128-
sudo ip l add breth1 type bridge
129-
fi
130-
sudo ip l set breth1 up
131-
if ! ip a show breth1 | grep 192.168.33.3/24; then
132-
sudo ip a add 192.168.33.3/24 dev breth1
133-
fi
134-
if ! ip l show dummy1 >/dev/null 2>&1; then
135-
sudo ip l add dummy1 type dummy
136-
fi
137-
sudo ip l set dummy1 up
138-
sudo ip l set dummy1 master breth1
139-
140-
# FIXME: Without this workaround we see the following issue after the runner is power cycled:
141-
# TASK [MichaelRigart.interfaces : RedHat | ensure network service is started and enabled] ***
142-
# Unable to start service network: Job for network.service failed because the control process exited with error code.
143-
# See \"systemctl status network.service\" and \"journalctl -xe\" for details.
144-
- name: Kill dhclient (workaround)
145-
run: |
146-
(sudo killall dhclient || true) && sudo systemctl restart network
128+
docker run --rm hello-world
147129
148130
- name: Install Kayobe
149131
run: |
@@ -154,23 +136,19 @@ jobs:
154136
pip install -U pip &&
155137
pip install ../src/kayobe
156138
157-
- name: Bootstrap the control host
158-
run: |
159-
source venvs/kayobe/bin/activate &&
160-
source src/kayobe-config/kayobe-env --environment ci-builder &&
161-
kayobe control host bootstrap
162-
163-
- name: Configure the seed host
139+
# Required for Docker registry login. Normally installed during host configure.
140+
- name: Install Docker Python SDK
164141
run: |
165-
source venvs/kayobe/bin/activate &&
166-
source src/kayobe-config/kayobe-env --environment ci-builder &&
167-
kayobe seed host configure
168-
env:
169-
KAYOBE_VAULT_PASSWORD: ${{ secrets.KAYOBE_VAULT_PASSWORD }}
142+
pip install --user docker
170143
171-
- name: Prune local Kolla container images over 1 week old
144+
- name: Configure localhost as a seed
172145
run: |
173-
sudo docker image prune --all --force --filter until=168h --filter="label=kolla_version"
146+
cat > src/kayobe-config/etc/kayobe/environments/ci-builder/inventory/hosts << EOF
147+
# A 'seed' host used for building images.
148+
# Use localhost for container image builds.
149+
[seed]
150+
localhost ansible_connection=local ansible_python_interpreter=/usr/bin/python3
151+
EOF
174152
175153
- name: Build and push kolla overcloud images
176154
run: |
@@ -203,7 +181,7 @@ jobs:
203181

204182
- name: Get built container images
205183
run: |
206-
sudo docker image ls --filter "reference=ark.stackhpc.com/stackhpc-dev/${{ matrix.distro }}-*:${{ needs.generate-tag.outputs.kolla_tag }}" > ${{ matrix.distro }}-container-images
184+
docker image ls --filter "reference=ark.stackhpc.com/stackhpc-dev/${{ matrix.distro }}-*:${{ needs.generate-tag.outputs.kolla_tag }}" > ${{ matrix.distro }}-container-images
207185
208186
- name: Fail if no images have been built
209187
run: if [ $(wc -l < ${{ matrix.distro }}-container-images) -le 1 ]; then exit 1; fi

0 commit comments

Comments
 (0)