create_vm_image.yaml 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. name: Create Github Actions Runner VM image
  2. on:
  3. workflow_dispatch:
  4. jobs:
  5. packer:
  6. runs-on: ubuntu-latest
  7. permissions: {}
  8. steps:
  9. - name: Checkout
  10. uses: actions/checkout@v4
  11. with:
  12. sparse-checkout: |
  13. .github
  14. ydb/ci/
  15. - name: packer build
  16. shell: bash
  17. env:
  18. YC_SERVICE_ACCOUNT_KEY_FILE: /tmp/yc_sa.json
  19. CUSTOM_VARS_FILE: /tmp/custom.pkrvars.hcl
  20. YC_SA_JSON_CREDENTIALS: ${{ secrets.YC_SA_JSON_CREDENTIALS }}
  21. GH_RUNNER_BUILD_IMAGE_CUSTOM_VARS_HCL: ${{ vars.GH_RUNNER_BUILD_IMAGE_CUSTOM_VARS_HCL }}
  22. run: |
  23. set -e
  24. echo "$YC_SA_JSON_CREDENTIALS" > "$YC_SERVICE_ACCOUNT_KEY_FILE"
  25. echo "$GH_RUNNER_BUILD_IMAGE_CUSTOM_VARS_HCL" > "$CUSTOM_VARS_FILE"
  26. args=()
  27. if [ -s "$CUSTOM_VARS_FILE" ]; then
  28. args+=(-var-file="$CUSTOM_VARS_FILE")
  29. fi
  30. set -x
  31. cd ./ydb/ci/gh-runner-image/
  32. packer init .
  33. packer build "${args[@]}" .