Skip to content

update ci to copy multiple files to s3 #1

update ci to copy multiple files to s3

update ci to copy multiple files to s3 #1

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
function_names:
required: true
type: array
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@v3
- 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@v2
with:
name: upload-artifcats
path: ${{ github.workspace }}/dist/*
- uses: actions/download-artifact@v2
id: download
with:
name: download artificacts
path: ${{ github.workspace }}/dist
- name: Display structure of downloaded files
run: ls -R
working-directory: ${{ steps.download.outputs.download-path }}
- name: Push function to Bucket
- uses: hashicorp/setup-terraform@v1
with:
terraform_version: ~1.0
- name: Terraform Init
id: init
run: terraform -chdir=${{ github.workspace }}/configs/crossplane/${{ inputs.env }} init
- uses: actions/download-artifact@v2
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 and 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
python scripts/workflows/scripts/patch_claim.py
for file in *-claims.yaml; do
if [ -f "$file" ]; then
cat "$file"
fi
done
env:
OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.STAGING_ONEPASSWORD_SERVICEACCOUNT_TOKEN }}
VAULT_ID: "errsir3kqd4gdjgaxliofyskey"
- name: Terraform apply
id: apply
run: |
echo "${{ secrets.STAGING_KUBECONFIG }}" > ${{ github.workspace }}/kubeconfig.yaml
export KUBECONFIG=${{ github.workspace }}/kubeconfig.yaml
terraform -chdir=${{ github.workspace }}/configs/crossplane/${{ inputs.env }} apply -auto-approve
env:
TF_WORKSPACE: ${{ inputs.env }}