zuul: add build jobs #163
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build image | |
on: | |
workflow_dispatch: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
paths: | |
- .github/workflows/build-image.yml | |
- image-create.sh | |
- user-data-template | |
- variants/*.yml | |
jobs: | |
build-image: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
variant: | |
- '1' | |
- '2' | |
- '3' | |
- 'osism-1' | |
- 'osism-2' | |
- 'osism-3' | |
- 'osism-4' | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install required packages | |
run: sudo apt-get install --yes xorriso sed curl gpg wget fdisk isolinux | |
- name: Install python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10' | |
- name: Prepare files | |
run: | | |
cp variants/disk-layout-${{ matrix.variant }}.yml include.d/disk-layout.yml | |
cp variants/runcmd-${{ matrix.variant }}.yml include.d/runcmd.yml | |
- name: Prepare user-data | |
run: | | |
pip3 install pipenv | |
pipenv install | |
pipenv run python3 render-user-data.py > user-data | |
- name: Validate user-data | |
run: | | |
cloud-init schema --config-file user-data | |
- name: Build image | |
run: | | |
bash image-create.sh -r -a -k -u user-data -n jammy | |
- name: Upload image | |
run: | | |
wget https://dl.min.io/client/mc/release/linux-amd64/mc | |
chmod +x mc | |
./mc alias set minio https://minio.services.osism.tech ${{ secrets.MINIO_ACCESS_KEY }} ${{ secrets.MINIO_SECRET_KEY }} | |
mv ubuntu-autoinstall.iso ubuntu-autoinstall-${{ matrix.variant }}.iso | |
./mc cp ubuntu-autoinstall-${{ matrix.variant }}.iso minio/node-image | |
./mc policy set download minio/node-image/ubuntu-autoinstall-${{ matrix.variant }}.iso | |
if: github.ref == 'refs/heads/main' | |
- name: Upload user-data | |
uses: actions/upload-artifact@v3 | |
with: | |
name: "user-data-${{ matrix.variant }}" | |
path: user-data |