|
1 | | -<% include "header.yml.j2" +%> |
2 | | - |
| 1 | +<%- if github_environment_selector == 'input' -%> |
| 2 | +<%- set github_runs_on = github_runs_on + ['${{ inputs.kayobe_environment }}'] -%> |
| 3 | +<%- set _ = workflow.update({"concurrency_group": "format('{0}-{1}', " + workflow.concurrency_group + ", '${{ inputs.kayobe_environment }}')" }) -%> |
| 4 | +<%- set _ = github_default_registry.update({"url": "${{ vars[format('{0}_REGISTRY_URL', inputs.kayobe_environment)] }}" }) -%> |
| 5 | +<%- set _ = github_default_registry.update({"username": "${{ vars[format('{0}_REGISTRY_USERNAME', inputs.kayobe_environment)] }}" }) -%> |
| 6 | +<%- set _ = github_default_registry.update({"password": "${{ secrets[format('{0}_REGISTRY_PASSWORD', inputs.kayobe_environment)] }}" }) -%> |
| 7 | +<%- set _ = github_default_kayobe_arguments.update({"KAYOBE_AUTOMATION_SSH_PRIVATE_KEY": "${{ secrets[format('{0}_KAYOBE_AUTOMATION_SSH_PRIVATE_KEY', inputs.kayobe_environment)] }}" }) -%> |
| 8 | +<%- set _ = github_default_kayobe_arguments.update({"KAYOBE_VAULT_PASSWORD": "${{ secrets[format('{0}_KAYOBE_VAULT_PASSWORD', inputs.kayobe_environment)] }}" }) -%> |
| 9 | +<%- set _ = github_kayobe_arguments.update({"KAYOBE_ENVIRONMENT": '${{ inputs.kayobe_environment }}'}) -%> |
| 10 | +<%- endif -%> |
| 11 | +<%- if github_environment_selector == 'single' -%> |
| 12 | +<%- set _ = github_kayobe_arguments.update({"KAYOBE_ENVIRONMENT": github_kayobe_environments | first}) -%> |
| 13 | +<%- endif -%> |
| 14 | +%% lookup('template', 'header.yml.j2') %% |
3 | 15 | jobs: |
| 16 | + prepare-runner: |
| 17 | + uses: ./.github/workflows/prepare-runner.yml |
4 | 18 | %% format_file_name(workflow.file_name) %%: |
5 | 19 | runs-on: %% github_runs_on %% |
6 | 20 | permissions: |
7 | 21 | contents: %% 'write' if 'KAYOBE_AUTOMATION_PR_TYPE' in workflow.arguments | flatten else 'read' %% |
8 | | - packages: %% 'read' if github_registry_url == 'ghcr.io' else 'none' %% |
| 22 | + packages: %% 'read' if (github_registry.url | default(github_default_registry.url)) == 'ghcr.io' else 'none' %% |
9 | 23 | pull-requests: %% 'write' if 'KAYOBE_AUTOMATION_PR_TYPE' in workflow.arguments | flatten else 'none' %% |
10 | 24 | container: |
11 | | - image: %% github_registry_url %%/%% github_image_name %%:%% github_image_tag %% |
| 25 | + image: %% github_registry.url | default(github_default_registry.url) %%/%% github_image_name %%:%% github_image_tag %% |
12 | 26 | credentials: |
13 | | - username: %% github_registry_username %% |
14 | | - password: %% github_registry_password %% |
| 27 | + username: %% github_registry.username | default(github_default_registry.username) %% |
| 28 | + password: %% github_registry.password | default(github_default_registry.password) %% |
15 | 29 | concurrency: |
16 | 30 | group: %% workflow.concurrency_group %% |
17 | 31 | cancel-in-progress: false |
18 | 32 | timeout-minutes: %% github_timeout %% |
| 33 | + needs: prepare-runner |
19 | 34 | steps: |
20 | 35 | <% if github_checkout_hook | length >= 1 %> |
21 | 36 | %% github_checkout_hook | indent(width=6, first=false) %% |
|
37 | 52 | /src/.automation/pipeline/%% workflow.file_name[4:-4] %%.sh |
38 | 53 | <%- if workflow.arguments is defined +%> |
39 | 54 | env: |
40 | | - KAYOBE_ENVIRONMENT: '%% github_kayobe_arguments.KAYOBE_ENVIRONMENT | default(github_default_kayobe_arguments.KAYOBE_ENVIRONMENT) %%' |
41 | | - KAYOBE_AUTOMATION_SSH_PRIVATE_KEY: '%% github_kayobe_arguments.KAYOBE_AUTOMATION_SSH_PRIVATE_KEY | default(github_default_kayobe_arguments.KAYOBE_AUTOMATION_SSH_PRIVATE_KEY) %%' |
42 | | - KAYOBE_VAULT_PASSWORD: '%% github_kayobe_arguments.KAYOBE_VAULT_PASSWORD | default(github_default_kayobe_arguments.KAYOBE_VAULT_PASSWORD) %%' |
| 55 | +<% if github_environment_selector is not none %> |
| 56 | + KAYOBE_ENVIRONMENT: '%% github_kayobe_arguments.KAYOBE_ENVIRONMENT %%' |
| 57 | +<% endif %> |
| 58 | + KAYOBE_AUTOMATION_SSH_PRIVATE_KEY: "%% github_kayobe_arguments.KAYOBE_AUTOMATION_SSH_PRIVATE_KEY | default(github_default_kayobe_arguments.KAYOBE_AUTOMATION_SSH_PRIVATE_KEY) %%" |
| 59 | + KAYOBE_VAULT_PASSWORD: "%% github_kayobe_arguments.KAYOBE_VAULT_PASSWORD | default(github_default_kayobe_arguments.KAYOBE_VAULT_PASSWORD) %%" |
43 | 60 | <%- for argument in workflow.arguments | flatten +%> |
44 | 61 | %% argument %%: '%% github_kayobe_arguments[argument] | default(github_default_kayobe_arguments[argument]) %%' |
45 | 62 | <%- endfor +%> |
|
0 commit comments