|
| 1 | +name: Build Azure CAPI VM image |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + inputs: |
| 6 | + version: |
| 7 | + description: Kuberentes version |
| 8 | + required: true |
| 9 | + type: string |
| 10 | + tag: |
| 11 | + description: ck8s-capi tag |
| 12 | + required: true |
| 13 | + type: string |
| 14 | + workflow_call: |
| 15 | + inputs: |
| 16 | + version: |
| 17 | + description: Kubernetes version |
| 18 | + required: true |
| 19 | + type: string |
| 20 | + |
| 21 | + tag: |
| 22 | + description: ck8s-capi tag |
| 23 | + required: true |
| 24 | + type: string |
| 25 | + |
| 26 | +env: |
| 27 | + version: ${{ inputs.version }} |
| 28 | + tag: ${{ inputs.tag }} |
| 29 | + docker_image: "ghcr.io/elastisys/image-builder-amd64:Automate-production-of-CAPI-VM-images-09c9dac9dc61dc069b72ac55e654cbe1a9190911" |
| 30 | + |
| 31 | +defaults: |
| 32 | + run: |
| 33 | + working-directory: ./images/capi |
| 34 | + shell: bash |
| 35 | + |
| 36 | +jobs: |
| 37 | + build-image: |
| 38 | + runs-on: ubuntu-24.04 |
| 39 | + steps: |
| 40 | + - name: Checkout repo |
| 41 | + uses: actions/checkout@v5 |
| 42 | + |
| 43 | + - name: replace variables |
| 44 | + run: | |
| 45 | + package="${version}-1.1" |
| 46 | + series="${version%.*}" |
| 47 | +
|
| 48 | + sed -r \ |
| 49 | + -e "s/\\\$KUBERNETES_SERIES/${series}/" \ |
| 50 | + -e "s/\\\$KUBERNETES_VERSION/${version}/" \ |
| 51 | + -e "s/\\\$KUBERNETES_DEB_VERSION/${package}/" \ |
| 52 | + -e "s/\\\$IMAGE_TAG/${tag}/" \ |
| 53 | + <"template.json" >"kubernetes.json" |
| 54 | +
|
| 55 | + - name: build azure image |
| 56 | + run: | |
| 57 | + image_name="ubuntu-2404-kube-${version%%-*}-ck8s-capi-${tag}" |
| 58 | +
|
| 59 | + export SIG_IMAGE_DEFINITION="${image_name}" |
| 60 | + export SIG_PUBLISHER="elastisys" |
| 61 | + export SIG_OFFER="ck8s-capi" |
| 62 | + export SIG_SKU="${image_name}" |
| 63 | +
|
| 64 | + docker run -i --rm \ |
| 65 | + -e PACKER_VAR_FILES -e PACKER_GITHUB_API_TOKEN=${{ secrets.GITHUB_TOKEN }} \ |
| 66 | + -e SIG_IMAGE_DEFINITION -e SIG_PUBLISHER -e SIG_OFFER -e SIG_SKU \ |
| 67 | + -e AZURE_SUBSCRIPTION_ID -e AZURE_CLIENT_ID -e AZURE_CLIENT_SECRET -e AZURE_TENANT_ID -e AZURE_LOCATION \ |
| 68 | + -e RESOURCE_GROUP_NAME -e GALLERY_NAME -e BUILD_RESOURCE_GROUP_NAME \ |
| 69 | + -v ${{ github.workspace }}/images/capi:/tmp/host \ |
| 70 | + ${{ env.docker_image }} build-azure-sig-ubuntu-2404-gen2 |
| 71 | +
|
| 72 | + env: |
| 73 | + PACKER_VAR_FILES: /tmp/host/kubernetes.json |
| 74 | + AZURE_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID}} |
| 75 | + AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }} |
| 76 | + AZURE_CLIENT_SECRET: ${{ secrets.AZURE_CLIENT_SECRET }} |
| 77 | + AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }} |
| 78 | + AZURE_LOCATION: ${{ secrets.AZURE_LOCATION }} |
| 79 | + RESOURCE_GROUP_NAME: ${{ secrets.RESOURCE_GROUP_NAME }} |
| 80 | + GALLERY_NAME: ${{ secrets.GALLERY_NAME }} |
| 81 | + BUILD_RESOURCE_GROUP_NAME: ${{ secrets.RESOURCE_GROUP_NAME }} |
0 commit comments