-
Notifications
You must be signed in to change notification settings - Fork 0
127 lines (107 loc) · 3.49 KB
/
release-crossplane.yaml
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
on:
workflow_call:
inputs:
role_name:
required: true
type: string
role_session_name:
required: true
type: string
aws_region:
required: false
type: string
default: eu-central-1
working_directory:
required: true
type: string
env:
required: true
type: string
permissions:
id-token: write
contents: read
pull-requests: write
statuses: write
jobs:
terraform:
name: Terraform
runs-on: ubuntu-latest
timeout-minutes: 15
defaults:
run:
working-directory: ${{ inputs.working_directory }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Configure AWS Credentials
id: aws
uses: aws-actions/configure-aws-credentials@v2
with:
role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID }}:role/${{ inputs.role_name }}
role-session-name: ${{ inputs.role_session_name }}
aws-region: ${{ inputs.aws_region }}
- name: Build lambdas
run: cd ${{ github.workspace }} && make lambda
env:
GITHUB_TOKEN: ${{ secrets.GB_TOKEN_PRIVATE }}
GOPRIVATE: "github.com/vimeda/*"
- name: Upload Build Artifacts
uses: actions/upload-artifact@v4
with:
name: srv-lambdas
path: ${{ github.workspace }}/dist/*
- uses: actions/download-artifact@v4
id: download
with:
name: srv-lambdas
path: ${{ github.workspace }}/dist
- name: Display structure of downloaded files
run: ls -R
working-directory: ${{ steps.download.outputs.download-path }}
- name: Push all functions to Bucket
run: |
cd ${{ github.workspace }}/dist && ls
for file in "./"/*lambda.zip
do
filename=$(basename "$file" .zip)
function_name=${filename%_lambda}
aws s3 cp "$file" "s3://${{inputs.env}}-lykon-lambdas/${{ github.event.repository.name}}/$function_name.zip"
done
- uses: hashicorp/setup-terraform@v2
with:
terraform_version: ~1.4
- uses: actions/download-artifact@v4
id: downloadscripts
with:
name: scripts
path: ./scripts
- name: copy scripts to scripts folder in working directory
run: |
mkdir ./scripts && ls
cp -r ${{ github.workspace }}/scripts/.github/workflows ./scripts
shell: sh
- name: Install 1Password Cli, patch claim
run: |
curl https://cache.agilebits.com/dist/1P/op2/pkg/v2.18.0/op_linux_amd64_v2.18.0.zip > op.zip
unzip op.zip
sudo mv op /usr/local/bin
rm op.zip
ls
python -m pip install "ruamel.yaml<0.18.0"
python scripts/workflows/scripts/patch.py
for file in *claims.yaml; do
if [ -f "$file" ]; then
cat $file
fi
done
env:
OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.PROD_ONEPASSWORD_SERVICEACCOUNT_TOKEN }}
VAULT_ID: "37y43e5v2qd3iptgt7wgyk34ga"
- name: Terraform apply
id: apply
run: |
echo "${{ secrets.PROD_KUBECONFIG }}" > ${{ github.workspace }}/kubeconfig.yaml
export KUBECONFIG=${{ github.workspace }}/kubeconfig.yaml
cd ${{ github.workspace }}/configs/crossplane && terraform init && terraform apply -auto-approve
env:
TF_WORKSPACE: prod