-
Notifications
You must be signed in to change notification settings - Fork 11
42 lines (39 loc) · 1.44 KB
/
jenkins_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
name: deploy_jenkins
on:
workflow_dispatch:
concurrency:
group: deploy_jenkins
cancel-in-progress: true
jobs:
deploy_docker:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
env:
AWS_ACCESS_KEY_ID: ${{ secrets.JENKINS_AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.JENKINS_AWS_SECRET_ACCESS_KEY }}
JENKINS_PRIV_KEY_PROD: "${{ secrets.JENKINS_PRIV_KEY_PROD }}"
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
DOCKERHUB_TOKEN_TLCPACKSTAGING: ${{ secrets.DOCKERHUB_TOKEN_TLCPACKSTAGING }}
defaults:
run:
working-directory: ./jenkins
steps:
-
name: Pull repository
uses: actions/checkout@v2
-
name: Source common environment variables to be used in ansible playbook
run: source ./scripts/common.sh
-
name: Pull Terraform state
run: ./scripts/pull_terraform_backend.sh
-
name: Write ansible key to file
run: echo "${{ secrets.GLOBAL_NODE_ACCESS_PRIVATE_KEY }}" > global_node_access_private_key
-
name: Set permissions on key file
run: chmod 600 global_node_access_private_key
-
name: Deploy docker images to head node
run: ANSIBLE_HOST_KEY_CHECKING=False ansible-playbook -i ansible_inventory.txt -u ubuntu -b --private-key=global_node_access_private_key ansible/playbooks/deploy_docker.yaml