forked from infobyte/gorrabot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
29 lines (29 loc) · 1.52 KB
/
.gitlab-ci.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
deploy:
stage: deploy
environment: dev
# Pull docker image
image: python:3.8-bullseye
# Setup AWS CLI to have proper credential keys
before_script:
- mkdir ~/.aws/
- touch ~/.aws/credentials
- apt-get update
- apt-get install software-properties-common -y
- curl -fsSL https://apt.releases.hashicorp.com/gpg | apt-key add -
- apt-add-repository "deb [arch=amd64] https://apt.releases.hashicorp.com $(lsb_release -cs) main"
- apt-get update && apt-get install vault -y
- setcap cap_ipc_lock= /usr/bin/vault
- export VAULT_TOKEN="$(vault write -field=token auth/jwt/login role=$VAULT_ROLE jwt=$CI_JOB_JWT)"
- if [ -z "$AWS_ACCESS_KEY_ID" ]; then export AWS_ACCESS_KEY_ID="$(vault kv get -field=AWS_ACCESS_KEY_ID secrets/gitlab/gorrabot-aws)"; fi; if [ -z "$AWS_ACCESS_KEY_ID" ]; then exit 1; fi
- if [ -z "$AWS_SECRET_ACCESS_KEY" ]; then export AWS_SECRET_ACCESS_KEY="$(vault kv get -field=AWS_SECRET_ACCESS_KEY secrets/gitlab/gorrabot-aws)"; fi; if [ -z "$AWS_SECRET_ACCESS_KEY" ]; then exit 1; fi
- printf "[eb-cli]\naws_access_key_id = %s\naws_secret_access_key = %s\n" "$AWS_ACCESS_KEY_ID" "$AWS_SECRET_ACCESS_KEY" >> ~/.aws/credentials
- pip install awsebcli
# Run deployment using EB CLI deploy on master branch
script:
- eb deploy gorrabot-dev
# Ensure to run deployment only on master branch
rules:
- if: $CI_COMMIT_REF_NAME == "master"
when: on_success
tags:
- faradaytests