-
Notifications
You must be signed in to change notification settings - Fork 1
84 lines (78 loc) · 2.43 KB
/
kosli_deploy.yml
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
name: Deploy
on:
workflow_call:
secrets:
KOSLI_API_TOKEN:
required: true
KOSLI_API_TOKEN_STAGING:
required: true
inputs:
AWS_ACCOUNT_ID:
required: true
type: string
AWS_REGION:
required: true
type: string
cyber_dojo_env_name_aws:
required: true
type: string
gh_actions_iam_role_name:
required: true
type: string
kosli_host_production:
required: true
type: string
kosli_host_staging:
required: true
type: string
tagged_image:
required: true
type: string
environment_name:
required: true
type: string
environment_url:
required: true
type: string
jobs:
report-expected-deployment:
runs-on: ubuntu-20.04
environment:
name: ${{ inputs.environment_name }}
url: ${{ inputs.environment_url }}
steps:
- uses: actions/checkout@v3
with:
ref: main
fetch-depth: 1
- name: Setup kosli
uses: kosli-dev/setup-cli-action@v2
with:
version: ${{ vars.KOSLI_CLI_VERSION }}
- name: Report expected deployment to Kosli
env:
CYBER_DOJO_ENV_NAME_AWS: ${{ inputs.cyber_dojo_env_name_aws }}
KOSLI_API_TOKEN: ${{ secrets.KOSLI_API_TOKEN }}
KOSLI_API_TOKEN_STAGING: ${{ secrets.KOSLI_API_TOKEN_STAGING }}
KOSLI_HOST_STAGING: ${{ inputs.kosli_host_staging }}
KOSLI_HOST_PRODUCTION: ${{ inputs.kosli_host_production }}
KOSLI_ORG: cyber-dojo
run: |
source ./sh/kosli.sh
kosli_expect_deployment ${CYBER_DOJO_ENV_NAME_AWS} ${KOSLI_HOST_STAGING} ${KOSLI_API_TOKEN_STAGING}
kosli_expect_deployment ${CYBER_DOJO_ENV_NAME_AWS} ${KOSLI_HOST_PRODUCTION} ${KOSLI_API_TOKEN}
deploy:
needs: [ report-expected-deployment ]
permissions:
id-token: write
contents: write
uses: fivexl/gh-workflow-tf-plan-apply/.github/workflows/[email protected]
with:
aws_region: ${{ inputs.AWS_REGION }}
aws_role_arn: arn:aws:iam::${{ inputs.AWS_ACCOUNT_ID }}:role/${{ inputs.gh_actions_iam_role_name }}
aws_default_region: ${{ inputs.AWS_REGION }}
aws_role_duration: 900
working_directory: deployment/terraform/
tf_apply: 'true'
tf_version: v1.4.5
tf_additional_env_vars: '{"TF_VAR_TAGGED_IMAGE": "${{ inputs.tagged_image }}"}'