aboutsummaryrefslogtreecommitdiffstats
path: root/.github/workflows/create_vm_image.yaml
blob: 0048d33231b7cfa527ea29c0b150a46dc82b62a7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
name: Create Github Actions Runner VM image
on:
  workflow_dispatch:

jobs:
  packer:
    runs-on: ubuntu-latest
    permissions: {}
    steps:
      - name: Checkout
        uses: actions/checkout@v4
        with:
          sparse-checkout: |
           .github
           ydb/ci/

      - name: packer build
        shell: bash
        env:
          YC_SERVICE_ACCOUNT_KEY_FILE: /tmp/yc_sa.json
          CUSTOM_VARS_FILE: /tmp/custom.pkrvars.hcl
          YC_SA_JSON_CREDENTIALS: ${{ secrets.YC_SA_JSON_CREDENTIALS }}
          GH_RUNNER_BUILD_IMAGE_CUSTOM_VARS_HCL: ${{ vars.GH_RUNNER_BUILD_IMAGE_CUSTOM_VARS_HCL }}
        run: |
          set -e
          echo "$YC_SA_JSON_CREDENTIALS" > "$YC_SERVICE_ACCOUNT_KEY_FILE"
          echo "$GH_RUNNER_BUILD_IMAGE_CUSTOM_VARS_HCL" > "$CUSTOM_VARS_FILE"
          
          args=()
          if [ -s "$CUSTOM_VARS_FILE" ]; then
            args+=(-var-file="$CUSTOM_VARS_FILE")
          fi
          
          set -x
          cd ./ydb/ci/gh-runner-image/
          packer init .
          packer build "${args[@]}" .