-
Notifications
You must be signed in to change notification settings - Fork 62
169 lines (155 loc) · 5.35 KB
/
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
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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
---
name: Deployment
on: # yamllint disable-line rule:truthy
workflow_run:
workflows:
- Integration Tests
branches:
- main
types:
- completed
workflow_dispatch:
jobs:
prepare-env:
runs-on: ubuntu-latest
outputs:
short_sha: ${{ steps.prepare.outputs.short_sha }}
steps:
- id: prepare
run: |
echo "short_sha=${GITHUB_SHA::7}" >> $GITHUB_OUTPUT
deploy-dev:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' || github.event_name == 'workflow_dispatch' }}
needs:
- prepare-env
environment:
name: dev
env:
SHORT_SHA: ${{needs.prepare-env.outputs.short_sha}}
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: |
pip install --user openshift
- name: Deploy dev environment
uses: dawidd6/action-ansible-playbook@v2
with:
playbook: playbooks/deploy.yml
directory: ./ansible
requirements: playbooks/requirements.yml
vault_password: ${{secrets.VAULT_PASSWORD}}
options: |
--extra-vars "operator_pipeline_image_tag=${{ github.sha }} suffix=${{needs.prepare-env.outputs.short_sha}} env=dev"
--skip-tags ci,import-index-images
--verbose
deploy-qa:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' || github.event_name == 'workflow_dispatch' }}
needs:
- prepare-env
environment:
name: qa
env:
SHORT_SHA: ${{needs.prepare-env.outputs.short_sha}}
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: |
pip install --user openshift
- name: Deploy qa environment
uses: dawidd6/action-ansible-playbook@v2
with:
playbook: playbooks/deploy.yml
directory: ./ansible
requirements: playbooks/requirements.yml
vault_password: ${{secrets.VAULT_PASSWORD}}
options: |
--extra-vars "operator_pipeline_image_tag=${{ github.sha }} suffix=${{needs.prepare-env.outputs.short_sha}} env=qa"
--skip-tags ci,import-index-images
--verbose
deploy-stage:
runs-on: ubuntu-latest
environment:
name: stage
env:
SHORT_SHA: ${{needs.prepare-env.outputs.short_sha}}
needs:
- prepare-env
- deploy-qa
- deploy-dev
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: |
pip install --user openshift
- name: Deploy stage environment
uses: dawidd6/action-ansible-playbook@v2
with:
playbook: playbooks/deploy.yml
directory: ./ansible
requirements: playbooks/requirements.yml
vault_password: ${{secrets.VAULT_PASSWORD}}
options: |
--extra-vars "operator_pipeline_image_tag=${{ github.sha }} suffix=${{needs.prepare-env.outputs.short_sha}} env=stage"
--skip-tags ci,import-index-images
--verbose
deploy-prod:
runs-on: ubuntu-latest
environment:
name: prod
env:
SHORT_SHA: ${{needs.prepare-env.outputs.short_sha}}
needs:
- prepare-env
- deploy-stage
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: |
pip install --user openshift
- name: Deploy prod environment
uses: dawidd6/action-ansible-playbook@v2
with:
playbook: playbooks/deploy.yml
directory: ./ansible
requirements: playbooks/requirements.yml
vault_password: ${{secrets.VAULT_PASSWORD_PROD}}
options: |
--extra-vars "operator_pipeline_image_tag=${{ github.sha }} suffix=${{needs.prepare-env.outputs.short_sha}} env=prod"
--skip-tags ci,import-index-images
--verbose
release:
name: Github release
runs-on: ubuntu-latest
permissions: write-all
needs:
- deploy-prod
steps:
- uses: actions/checkout@v4
- name: Bump version and push tag
id: tag_version
uses: mathieudutour/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Create a GitHub release
uses: ncipollo/release-action@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag: ${{ steps.tag_version.outputs.new_tag }}
name: Release ${{ steps.tag_version.outputs.new_tag }}
body: ${{ steps.tag_version.outputs.changelog }}
- name: Log in to Quay.io
uses: redhat-actions/podman-login@v1
with:
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_PASSWORD }}
registry: quay.io
- name: Tag image with a release tag
run: |
podman pull quay.io/redhat-isv/operator-pipelines-images:${{ github.sha }}
podman tag quay.io/redhat-isv/operator-pipelines-images:${{ github.sha }} quay.io/redhat-isv/operator-pipelines-images:released
podman tag quay.io/redhat-isv/operator-pipelines-images:${{ github.sha }} quay.io/redhat-isv/operator-pipelines-images:${{ steps.tag_version.outputs.new_tag }}
podman push quay.io/redhat-isv/operator-pipelines-images:released
podman push quay.io/redhat-isv/operator-pipelines-images:${{ steps.tag_version.outputs.new_tag }}