Skip to content

Commit 2837296

Browse files
committed
Configure CI/CD to use a latest image build
The deploy action was extended with a build configuration and the individual steps of release use the image with a latest commit sha. JIRA: ISV-1363, ISV-1364
1 parent 6acba38 commit 2837296

File tree

8 files changed

+106
-74
lines changed

8 files changed

+106
-74
lines changed

.github/workflows/deploy.yml

Lines changed: 80 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,46 @@ on: # yamllint disable-line rule:truthy
55
workflow_run:
66
workflows:
77
- E2E-CI
8+
- validation
89
branches:
910
- main
1011
types:
1112
- completed
12-
workflow_dispatch:
1313

1414
jobs:
15+
build:
16+
name: Build and push image
17+
runs-on: ubuntu-latest
18+
19+
steps:
20+
- uses: actions/checkout@v2
21+
22+
- name: Build Image
23+
id: build-image
24+
uses: redhat-actions/buildah-build@v2
25+
with:
26+
image: operator-pipelines-images
27+
tags: latest ${{ github.sha }}
28+
dockerfiles: |
29+
./operator-pipeline-images/Dockerfile
30+
31+
- name: Push To quay.io
32+
id: push-to-quay
33+
uses: redhat-actions/push-to-registry@v2
34+
with:
35+
image: ${{ steps.build-image.outputs.image }}
36+
tags: ${{ steps.build-image.outputs.tags }}
37+
registry: quay.io/redhat-isv
38+
username: ${{ secrets.REGISTRY_USERNAME }}
39+
password: ${{ secrets.REGISTRY_PASSWORD }}
40+
41+
- name: Print image url
42+
run: echo "Image pushed to ${{ steps.push-to-quay.outputs.registry-paths }}"
43+
1544
deploy-dev:
1645
runs-on: ubuntu-latest
46+
needs:
47+
- build
1748
environment:
1849
name: dev
1950
steps:
@@ -30,12 +61,14 @@ jobs:
3061
vault_password: ${{secrets.VAULT_PASSWORD}}
3162
options: |
3263
--inventory inventory/operator-pipeline
33-
--extra-vars env=dev
64+
--extra-vars "env=dev operator_pipeline_image_tag=${{ github.sha }}"
3465
--skip-tags ci
3566
--verbose
3667
3768
deploy-qa:
3869
runs-on: ubuntu-latest
70+
needs:
71+
- build
3972
environment:
4073
name: qa
4174
steps:
@@ -52,7 +85,7 @@ jobs:
5285
vault_password: ${{secrets.VAULT_PASSWORD}}
5386
options: |
5487
--inventory inventory/operator-pipeline
55-
--extra-vars env=qa
88+
--extra-vars "env=qa operator_pipeline_image_tag=${{ github.sha }}"
5689
--skip-tags ci
5790
--verbose
5891
@@ -61,8 +94,8 @@ jobs:
6194
environment:
6295
name: stage
6396
needs:
64-
- deploy-dev
6597
- deploy-qa
98+
- deploy-dev
6699
steps:
67100
- uses: actions/checkout@v1
68101
- name: Install dependencies
@@ -77,7 +110,7 @@ jobs:
77110
vault_password: ${{secrets.VAULT_PASSWORD}}
78111
options: |
79112
--inventory inventory/operator-pipeline
80-
--extra-vars env=stage
113+
--extra-vars "env=stage operator_pipeline_image_tag=${{ github.sha }}"
81114
--skip-tags ci
82115
--verbose
83116
@@ -101,6 +134,47 @@ jobs:
101134
vault_password: ${{secrets.VAULT_PASSWORD}}
102135
options: |
103136
--inventory inventory/operator-pipeline
104-
--extra-vars env=prod
137+
--extra-vars "env=prod operator_pipeline_image_tag=${{ github.sha }}"
105138
--skip-tags ci
106139
--verbose
140+
141+
release:
142+
name: Github release
143+
runs-on: ubuntu-latest
144+
needs:
145+
- deploy-prod
146+
steps:
147+
- uses: actions/checkout@v2
148+
149+
- name: Bump version and push tag
150+
id: tag_version
151+
uses: mathieudutour/[email protected]
152+
with:
153+
github_token: ${{ secrets.GITHUB_TOKEN }}
154+
155+
- name: Create a GitHub release
156+
uses: actions/create-release@v1
157+
env:
158+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
159+
with:
160+
tag_name: ${{ steps.tag_version.outputs.new_tag }}
161+
release_name: Release ${{ steps.tag_version.outputs.new_tag }}
162+
body: ${{ steps.tag_version.outputs.changelog }}
163+
164+
- name: Log in to Quay.io
165+
uses: redhat-actions/podman-login@v1
166+
with:
167+
username: ${{ secrets.REGISTRY_USERNAME }}
168+
password: ${{ secrets.REGISTRY_PASSWORD }}
169+
registry: quay.io
170+
171+
- name: Tag image with a release tag
172+
run: |
173+
174+
podman pull quay.io/redhat-isv/operator-pipelines-images:${{ github.sha }}
175+
176+
podman tag quay.io/redhat-isv/operator-pipelines-images:${{ github.sha }} quay.io/redhat-isv/operator-pipelines-images:released
177+
podman tag quay.io/redhat-isv/operator-pipelines-images:${{ github.sha }} quay.io/redhat-isv/operator-pipelines-images:${{ steps.tag_version.outputs.new_tag }}
178+
179+
podman push quay.io/redhat-isv/operator-pipelines-images:released
180+
podman push quay.io/redhat-isv/operator-pipelines-images:${{ steps.tag_version.outputs.new_tag }}

.github/workflows/main-image.yml

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,11 @@
11
name: Build and Push Image
22
on: # yamllint disable-line rule:truthy
3-
- push
4-
- pull_request
3+
pull_request:
4+
push:
5+
branches:
6+
- main
57

68
jobs:
7-
test-lint:
8-
name: Run unit tests and linters
9-
runs-on: ubuntu-latest
10-
steps:
11-
- uses: actions/checkout@v2
12-
- uses: fedora-python/[email protected]
13-
with:
14-
tox_env: black,test
15-
dnf_install: krb5-devel krb5-workstation
16-
179
build:
1810
name: Build and push image
1911
runs-on: ubuntu-20.04

.github/workflows/ppc64le-image.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
name: Build and Push ppc64le Image
22
on: # yamllint disable-line rule:truthy
3-
- push
4-
- pull_request
3+
pull_request:
4+
push:
5+
branches:
6+
- main
57

68
jobs:
79
build:

.github/workflows/release-image.yml

Lines changed: 0 additions & 48 deletions
This file was deleted.

.github/workflows/validation.yml

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,25 @@
22
name: validation
33

44
on: # yamllint disable-line rule:truthy
5-
- push
6-
- pull_request
5+
pull_request:
6+
push:
7+
branches:
8+
- main
79

810
jobs:
9-
linting:
11+
yaml-lint:
1012
runs-on: ubuntu-latest
1113
steps:
1214
- uses: actions/checkout@v1
1315
- name: yaml-lint
1416
uses: ibiqlik/action-yamllint@v3
17+
18+
tox:
19+
name: Run unit tests and linters
20+
runs-on: ubuntu-latest
21+
steps:
22+
- uses: actions/checkout@v2
23+
- uses: fedora-python/[email protected]
24+
with:
25+
tox_env: black,test
26+
dnf_install: krb5-devel krb5-workstation

ansible/roles/operator-pipeline/templates/openshift/pipelines/operator-ci-pipeline.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ spec:
4040
default: "false"
4141
- name: pipeline_image
4242
description: An image of operator-pipeline-images.
43-
default: "quay.io/redhat-isv/operator-pipelines-images:v1.0.8"
43+
default: "quay.io/redhat-isv/operator-pipelines-images:released"
4444
workspaces:
4545
- name: pipeline
4646
- name: kubeconfig

ansible/roles/operator-pipeline/templates/openshift/pipelines/operator-hosted-pipeline.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ spec:
3030
description: The namespace/organization all built images will be pushed to.
3131
- name: pipeline_image
3232
description: An image of operator-pipeline-images.
33-
default: "quay.io/redhat-isv/operator-pipelines-images:v1.0.8"
33+
default: "quay.io/redhat-isv/operator-pipelines-images:released"
3434
- name: github_token_secret_name
3535
description: The name of the Kubernetes Secret that contains the GitHub token.
3636
default: github-bot-token

ansible/roles/operator-pipeline/templates/openshift/pipelines/operator-release-pipeline.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ spec:
2929
default: "prod"
3030
- name: pipeline_image
3131
description: An image of operator-pipeline-images.
32-
default: "quay.io/redhat-isv/operator-pipelines-images:v1.0.8"
32+
default: "quay.io/redhat-isv/operator-pipelines-images:released"
3333
- name: github_token_secret_name
3434
description: The name of the Kubernetes Secret that contains the GitHub token.
3535
default: github-bot-token

0 commit comments

Comments
 (0)