Skip to content

Commit 75c38d2

Browse files
authored
Merge pull request #922 from stackhpc/yoga-container-build-on-arc
CI: Use ARC runners for container image build jobs
2 parents 693bd94 + f8947a9 commit 75c38d2

File tree

3 files changed

+47
-49
lines changed

3 files changed

+47
-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

etc/kayobe/kolla.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,12 +317,26 @@ kolla_build_blocks:
317317
sed -i -e '/\[{{ repo.tag }}\]/,/^\[/ s/^\(mirrorlist *=.*\)/#\1/g' \
318318
-e '/\[{{ repo.tag }}\]/,/^\[/ s/^[# ]*\(baseurl *=.*\)/#\1/g' \
319319
-e '/\[{{ repo.tag }}\]/,/^\[/ s/^[# ]*\(metalink *=.*\)/#\1/g' \
320+
{% if stackhpc_repo_mirror_username is truthy %}
321+
-e '/\[{{ repo.tag }}\]/,/^\[/ s|^\(name.*\)|\1\nusername={{ stackhpc_repo_mirror_username }}|' \
322+
-e '/\[{{ repo.tag }}\]/,/^\[/ s|^\(name.*\)|\1\npassword={{ stackhpc_repo_mirror_password }}|' \
323+
{% endif %}
320324
-e '/\[{{ repo.tag }}\]/,/^\[/ s|^\(name.*\)|\1\nbaseurl={{ repo.url }}|' /etc/yum.repos.d/{{ repo.file }}{% if not loop.last %} && \
321325
{% endif %}
322326
{% endfor %}
323327
{% else %}
324328
RUN \
325329
rm /etc/apt/sources.list && \
330+
rm -f /etc/apt/auth.conf && \
331+
{% if stackhpc_repo_mirror_url | urlsplit('scheme') == 'https' %}
332+
{# We lack the ca-certificates package at this stage, so don't verify the CA #}
333+
echo 'Acquire::https::Verify-Peer "false";' > /etc/apt/apt.conf.d/90no-verify-peer && \
334+
{% endif %}
335+
{% if stackhpc_repo_mirror_username is truthy %}
336+
echo 'machine {{ stackhpc_repo_mirror_url }}' >> /etc/apt/auth.conf && \
337+
echo 'login {{ stackhpc_repo_mirror_username }}' >> /etc/apt/auth.conf && \
338+
echo 'password {{ stackhpc_repo_mirror_password }}' >> /etc/apt/auth.conf && \
339+
{% endif %}
326340
{% for repo in stackhpc_ubuntu_focal_base_repos %}
327341
echo '{{ repo }}' >> /etc/apt/sources.list {% if not loop.last %} && \
328342
{% endif %}
@@ -340,6 +354,10 @@ kolla_build_blocks:
340354
sed -i -e '/\[{{ repo.tag }}\]/,/^\[/ s/^\(mirrorlist *=.*\)/#\1/g' \
341355
-e '/\[{{ repo.tag }}\]/,/^\[/ s/^[# ]*\(baseurl *=.*\)/#\1/g' \
342356
-e '/\[{{ repo.tag }}\]/,/^\[/ s/^[# ]*\(metalink *=.*\)/#\1/g' \
357+
{% if stackhpc_repo_mirror_username is truthy %}
358+
-e '/\[{{ repo.tag }}\]/,/^\[/ s|^\(name.*\)|\1\nusername={{ stackhpc_repo_mirror_username }}|' \
359+
-e '/\[{{ repo.tag }}\]/,/^\[/ s|^\(name.*\)|\1\npassword={{ stackhpc_repo_mirror_password }}|' \
360+
{% endif %}
343361
-e '/\[{{ repo.tag }}\]/,/^\[/ s|^\(name.*\)|\1\nbaseurl={{ repo.url }}|' /etc/yum.repos.d/{{ repo.file }}{% if not loop.last %} &&{% endif %} \
344362
{% endfor %}
345363
{% endif %}
@@ -350,6 +368,13 @@ kolla_build_blocks:
350368
{% endif %}
351369
RUN \
352370
rm /etc/apt/sources.list && \
371+
rm -f /etc/apt/auth.conf && \
372+
rm -f /etc/apt/apt.conf.d/90no-verify-peer && \
373+
{% if stackhpc_repo_mirror_username is truthy %}
374+
echo 'machine {{ stackhpc_repo_mirror_url }}' >> /etc/apt/auth.conf && \
375+
echo 'login {{ stackhpc_repo_mirror_username }}' >> /etc/apt/auth.conf && \
376+
echo 'password {{ stackhpc_repo_mirror_password }}' >> /etc/apt/auth.conf && \
377+
{% endif %}
353378
{% for repo in stackhpc_ubuntu_focal_repos %}
354379
echo '{{ repo }}' >> /etc/apt/sources.list {% if not loop.last %} && \
355380
{% endif %}

0 commit comments

Comments
 (0)