Add production environment (#1753) #1
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| --- | |
| name: Prod Deploy | |
| on: | |
| push: | |
| tags: | |
| - "v*.*.*" | |
| workflow_dispatch: {} | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref_name }} | |
| cancel-in-progress: true | |
| env: | |
| COB_DATAPIPELINE_BRANCH: ${{ github.ref_name }} | |
| jobs: | |
| prod-deploy: | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: production | |
| timeout-minutes: 30 | |
| strategy: | |
| matrix: | |
| python-version: [ 3.12 ] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| cache: "pipenv" | |
| - name: Install pipenv | |
| run: curl https://raw.githubusercontent.com/pypa/pipenv/master/get-pipenv.py | python | |
| - name: Install dependencies | |
| run: pipenv install --dev | |
| - name: Checkout ansible-playbook-airflow (private) | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: tulibraries/ansible-playbook-airflow | |
| token: ${{ secrets.MY_PAT }} | |
| path: ansible-playbook-airflow | |
| ref: main | |
| - name: Dump vault password to disk | |
| env: | |
| ANSIBLE_VAULT_PASSWORD: ${{ secrets.ANSIBLE_VAULT_PASSWORD }} | |
| run: | | |
| printf '%s' "${ANSIBLE_VAULT_PASSWORD}" > "$HOME/.vault" | |
| chmod 600 "$HOME/.vault" | |
| - name: Start ssh-agent and add key | |
| uses: webfactory/[email protected] | |
| with: | |
| ssh-private-key: ${{ secrets.DEPLOY_SSH_KEY }} | |
| - name: Run Ansible Airflow Playbook for Prod | |
| working-directory: ansible-playbook-airflow | |
| run: | | |
| pipenv run ansible-galaxy install -r requirements.yml | |
| pipenv run ansible-playbook -i inventory/prod playbook.yml --tags "jumphost,role::airflow::dags" --vault-password-file "$HOME/.vault" -e 'ansible_ssh_port=9229' -e cob_datapipeline_branch=$COB_DATAPIPELINE_BRANCH |