Skip to content

Commit

Permalink
WIP: Build containers in a container
Browse files Browse the repository at this point in the history
  • Loading branch information
markgoddard committed Jan 23, 2024
1 parent 5b2b98b commit 003e07b
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 70 deletions.
45 changes: 14 additions & 31 deletions .github/workflows/overcloud-host-image-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,16 @@ jobs:
overcloud-host-image-build:
name: Build overcloud host images
if: github.repository == 'stackhpc/stackhpc-kayobe-config'
runs-on: [self-hosted, stackhpc-kayobe-config-kolla-builder-rl9]
runs-on: arc-skc-aio-runner
permissions: {}
steps:
- uses: actions/checkout@v4
- name: Install package dependencies
run: |
sudo apt update
sudo apt install -y build-essential git unzip nodejs python3-wheel python3-pip python3-venv
- name: Checkout
uses: actions/checkout@v4
with:
path: src/kayobe-config

Expand All @@ -55,30 +61,15 @@ jobs:
rm -f /tmp/updated_images.txt
- name: Clone StackHPC Kayobe repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
repository: stackhpc/kayobe
ref: refs/heads/stackhpc/${{ steps.openstack_release.outputs.openstack_release }}
path: src/kayobe

- name: Install dependencies
run: |
sudo dnf -y install zstd debootstrap
- name: Setup networking
- name: Install image build dependencies
run: |
if ! ip l show breth1 >/dev/null 2>&1; then
sudo ip l add breth1 type bridge
fi
sudo ip l set breth1 up
if ! ip a show breth1 | grep 192.168.33.3/24; then
sudo ip a add 192.168.33.3/24 dev breth1
fi
if ! ip l show dummy1 >/dev/null 2>&1; then
sudo ip l add dummy1 type dummy
fi
sudo ip l set dummy1 up
sudo ip l set dummy1 master breth1
sudo apt -y install zstd debootstrap
- name: Install Kayobe
run: |
Expand All @@ -93,20 +84,12 @@ jobs:
run: |
source venvs/kayobe/bin/activate &&
source src/kayobe-config/kayobe-env --environment ci-builder &&
kayobe control host bootstrap
- name: Configure the seed host
run: |
source venvs/kayobe/bin/activate &&
source src/kayobe-config/kayobe-env --environment ci-builder &&
kayobe seed host configure
env:
KAYOBE_VAULT_PASSWORD: ${{ secrets.KAYOBE_VAULT_PASSWORD }}
kayobe control host bootstrap --skip-tags bootstrap
- name: Create bifrost_httpboot Docker volume
run: |
if [[ $(sudo docker volume ls -f Name=bifrost_httpboot -q | wc -l) = 0 ]]; then
sudo docker volume create bifrost_httpboot
if [[ $(docker volume ls -f Name=bifrost_httpboot -q | wc -l) = 0 ]]; then
docker volume create bifrost_httpboot
fi
- name: Generate clouds.yaml
Expand Down
50 changes: 16 additions & 34 deletions .github/workflows/stackhpc-container-image-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,15 @@ jobs:
generate-tag:
name: Generate container image tag
if: github.repository == 'stackhpc/stackhpc-kayobe-config'
runs-on: [self-hosted, stackhpc-kayobe-config-kolla-builder-rl9]
runs-on: arc-skc-aio-runner
permissions: {}
outputs:
datetime_tag: ${{ steps.datetime_tag.outputs.datetime_tag }}
matrix: ${{ steps.set-matrix.outputs.matrix }}
openstack_release: ${{ steps.openstack_release.outputs.openstack_release }}
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Determine OpenStack release
id: openstack_release
Expand Down Expand Up @@ -88,7 +88,7 @@ jobs:
container-image-build:
name: Build Kolla container images
if: github.repository == 'stackhpc/stackhpc-kayobe-config'
runs-on: [self-hosted, stackhpc-kayobe-config-kolla-builder-rl9]
runs-on: arc-skc-aio-runner
timeout-minutes: 720
permissions: {}
strategy:
Expand All @@ -97,32 +97,23 @@ jobs:
needs:
- generate-tag
steps:
- uses: actions/checkout@v3
- name: Install package dependencies
run: |
sudo apt update
sudo apt install -y build-essential git unzip nodejs python3-wheel python3-pip python3-venv
- name: Checkout
uses: actions/checkout@v4
with:
path: src/kayobe-config

- name: Clone StackHPC Kayobe repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
repository: stackhpc/kayobe
ref: refs/heads/stackhpc/${{ needs.generate-tag.outputs.openstack_release }}
path: src/kayobe

- name: Setup networking
run: |
if ! ip l show breth1 >/dev/null 2>&1; then
sudo ip l add breth1 type bridge
fi
sudo ip l set breth1 up
if ! ip a show breth1 | grep 192.168.33.3/24; then
sudo ip a add 192.168.33.3/24 dev breth1
fi
if ! ip l show dummy1 >/dev/null 2>&1; then
sudo ip l add dummy1 type dummy
fi
sudo ip l set dummy1 up
sudo ip l set dummy1 master breth1
- name: Install Kayobe
run: |
mkdir -p venvs &&
Expand All @@ -132,23 +123,14 @@ jobs:
pip install -U pip &&
pip install ../src/kayobe
- name: Bootstrap the control host
# Required for Docker registry login. Normally installed during host configure.
- name: Install Docker Python SDK
run: |
source venvs/kayobe/bin/activate &&
source src/kayobe-config/kayobe-env --environment ci-builder &&
kayobe control host bootstrap
- name: Configure the seed host
run: |
source venvs/kayobe/bin/activate &&
source src/kayobe-config/kayobe-env --environment ci-builder &&
kayobe seed host configure
env:
KAYOBE_VAULT_PASSWORD: ${{ secrets.KAYOBE_VAULT_PASSWORD }}
pip install --user docker
- name: Prune local Kolla container images over 1 week old
run: |
sudo docker image prune --all --force --filter until=168h --filter="label=kolla_version"
docker image prune --all --force --filter until=168h --filter="label=kolla_version"
- name: Build and push kolla overcloud images
run: |
Expand Down Expand Up @@ -183,7 +165,7 @@ jobs:

- name: Get built container images
run: |
sudo docker image ls --filter "reference=ark.stackhpc.com/stackhpc-dev/*:*${{ matrix.distro }}*${{ needs.generate-tag.outputs.datetime_tag }}" > ${{ matrix.distro }}-container-images
docker image ls --filter "reference=ark.stackhpc.com/stackhpc-dev/*:*${{ matrix.distro }}*${{ needs.generate-tag.outputs.datetime_tag }}" > ${{ matrix.distro }}-container-images
- name: Fail if no images have been built
run: if [ $(wc -l < ${{ matrix.distro }}-container-images) -le 1 ]; then exit 1; fi
Expand Down
3 changes: 0 additions & 3 deletions etc/kayobe/environments/ci-builder/inventory/groups
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
[seed]

[container-image-builders:children]
seed

[network]

[docker:children]
Expand Down
4 changes: 2 additions & 2 deletions etc/kayobe/environments/ci-builder/inventory/hosts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# A 'seed' host used for building images.
# Use localhost for container and disk image builds.
[seed]
builder
localhost ansible_connection=local ansible_python_interpreter=/usr/bin/python3

0 comments on commit 003e07b

Please sign in to comment.