Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Creating Github actions workflow to migrate CI/CD pipeline away from Jenkins #37

Closed
wants to merge 148 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
148 commits
Select commit Hold shift + click to select a range
59a6100
adding action.yml and main.yml
rajpalc7 Jan 17, 2024
fed7fe1
deleting action file
rajpalc7 Jan 17, 2024
0078d39
adding action.yml
rajpalc7 Jan 17, 2024
87c1adb
testing workflow
rajpalc7 Jan 17, 2024
d9d439f
test
rajpalc7 Jan 17, 2024
31d87fa
yml to yaml
rajpalc7 Jan 17, 2024
61f7440
test
rajpalc7 Jan 17, 2024
0e09409
test
rajpalc7 Jan 17, 2024
8df3aa7
test
rajpalc7 Jan 17, 2024
4ce7a8f
updating version
rajpalc7 Jan 17, 2024
389bab2
docker push change
rajpalc7 Jan 17, 2024
3c5d2db
test
rajpalc7 Jan 17, 2024
b0b1ec6
test
rajpalc7 Jan 17, 2024
311f0b0
test
rajpalc7 Jan 17, 2024
642e110
test
rajpalc7 Jan 17, 2024
589f478
test
rajpalc7 Jan 17, 2024
e69cb31
test
rajpalc7 Jan 20, 2024
b3024a7
test
rajpalc7 Jan 22, 2024
56090ae
test
rajpalc7 Jan 23, 2024
571aadc
test
rajpalc7 Jan 23, 2024
69ff2dc
test
rajpalc7 Jan 23, 2024
280c30f
test
rajpalc7 Jan 23, 2024
5238776
test
rajpalc7 Jan 23, 2024
3bc9720
test
rajpalc7 Jan 24, 2024
d5daa0f
test
rajpalc7 Jan 24, 2024
02e8b5e
test
rajpalc7 Jan 24, 2024
6d15a2e
test
rajpalc7 Jan 25, 2024
c27af88
test
rajpalc7 Jan 25, 2024
8d1f3be
test
rajpalc7 Jan 25, 2024
6d3a656
test
rajpalc7 Jan 25, 2024
07c06ac
test
rajpalc7 Jan 25, 2024
b6e6385
test
rajpalc7 Jan 25, 2024
312c3d0
test
rajpalc7 Jan 25, 2024
90cb55d
test
rajpalc7 Jan 25, 2024
4dda4ae
test
rajpalc7 Jan 25, 2024
53502df
test
rajpalc7 Jan 25, 2024
d6f9ed8
test
rajpalc7 Jan 25, 2024
d662c1c
test
rajpalc7 Jan 25, 2024
f7968f7
test
rajpalc7 Jan 25, 2024
b0df30b
moving from jenkins to gha
rajpalc7 Jan 29, 2024
286c899
test
rajpalc7 Jan 29, 2024
7c4ea59
adding rocket chat notification
rajpalc7 Jan 29, 2024
6c6aab2
quick fix
rajpalc7 Jan 29, 2024
cba4571
test
rajpalc7 Jan 31, 2024
fadde47
test
rajpalc7 Jan 31, 2024
ff3a2cd
test
rajpalc7 Jan 31, 2024
d1d267a
formatting fix
rajpalc7 Jan 31, 2024
ccebc63
test
rajpalc7 Feb 1, 2024
095f299
test
rajpalc7 Feb 1, 2024
9f6e2fa
test
rajpalc7 Feb 2, 2024
ed4c06f
test
rajpalc7 Feb 2, 2024
51e3cff
TEST
rajpalc7 Feb 2, 2024
b5cac31
test
rajpalc7 Feb 2, 2024
4cc699b
fixing the hard coded part
rajpalc7 Feb 2, 2024
dcd7aa8
testing
rajpalc7 Feb 6, 2024
2eab3b1
fixing override of the base image
rajpalc7 Feb 7, 2024
b4c8b30
executing the command
rajpalc7 Feb 7, 2024
feb5fbe
test
rajpalc7 Feb 7, 2024
2ba2f42
test
rajpalc7 Feb 7, 2024
c459b27
testing base image
rajpalc7 Feb 8, 2024
1776a4a
updating and pulling base image
rajpalc7 Feb 8, 2024
b18148b
test
rajpalc7 Feb 8, 2024
cb5bcf9
test
rajpalc7 Feb 10, 2024
b7e1b0c
test
rajpalc7 Feb 10, 2024
c6c6ae3
fixing base image
rajpalc7 Feb 12, 2024
58d022c
test
rajpalc7 Feb 12, 2024
118f5b1
test
rajpalc7 Feb 13, 2024
42ee259
test
rajpalc7 Feb 14, 2024
3315431
Create labels.txt
rajpalc7 Feb 14, 2024
bc1a285
test
rajpalc7 Feb 14, 2024
cf09169
test
rajpalc7 Feb 14, 2024
0a9ce58
test
rajpalc7 Feb 15, 2024
40d5f13
test
rajpalc7 Feb 15, 2024
42bda2a
test
rajpalc7 Feb 15, 2024
129c482
test
rajpalc7 Feb 15, 2024
6b48537
test
rajpalc7 Feb 15, 2024
ee768a3
test
rajpalc7 Feb 15, 2024
9e33c30
test
rajpalc7 Feb 15, 2024
386535e
test
rajpalc7 Feb 15, 2024
f3cf208
test
rajpalc7 Feb 15, 2024
1f40724
test
rajpalc7 Feb 15, 2024
763f64a
test
rajpalc7 Feb 15, 2024
37ba47c
test
rajpalc7 Feb 15, 2024
9c63aac
test
rajpalc7 Feb 15, 2024
a068c77
test
rajpalc7 Feb 15, 2024
6de2f4d
test
rajpalc7 Feb 15, 2024
1c169ce
test
rajpalc7 Feb 15, 2024
7873066
test
rajpalc7 Feb 16, 2024
96dae8f
test
rajpalc7 Feb 16, 2024
989dfd5
test
rajpalc7 Feb 16, 2024
2659714
test
rajpalc7 Feb 16, 2024
f8ed34e
test
rajpalc7 Feb 16, 2024
5a87f69
test
rajpalc7 Feb 16, 2024
6985969
clean up
rajpalc7 Feb 16, 2024
9ea26b1
test
rajpalc7 Feb 21, 2024
d636388
test
rajpalc7 Feb 21, 2024
e1cab01
test
rajpalc7 Feb 21, 2024
9fde0a9
test
rajpalc7 Feb 21, 2024
65ecf65
test
rajpalc7 Feb 22, 2024
cf5209d
TEST
rajpalc7 Feb 22, 2024
6dd266d
test
rajpalc7 Feb 23, 2024
d04954e
TEST
rajpalc7 Feb 23, 2024
3d1d1da
test
rajpalc7 Feb 23, 2024
f0f4eac
test
rajpalc7 Feb 23, 2024
6d04e02
test
rajpalc7 Feb 23, 2024
903749b
test
rajpalc7 Feb 23, 2024
9a4952a
test
rajpalc7 Feb 23, 2024
2fd0c19
test
rajpalc7 Feb 23, 2024
661bcb9
test
rajpalc7 Feb 23, 2024
97ea771
test
rajpalc7 Feb 23, 2024
65fa73f
test
rajpalc7 Feb 24, 2024
58f363f
test
rajpalc7 Feb 24, 2024
10662f3
test
rajpalc7 Feb 24, 2024
2ec1f1c
test
rajpalc7 Feb 24, 2024
155320a
test
rajpalc7 Feb 24, 2024
5ede59a
test
rajpalc7 Feb 24, 2024
358ebc4
test
rajpalc7 Feb 24, 2024
b92e257
test
rajpalc7 Feb 24, 2024
f400532
test
rajpalc7 Feb 24, 2024
084cb1e
test
rajpalc7 Feb 24, 2024
bd528d7
test
rajpalc7 Feb 24, 2024
6e34900
test
rajpalc7 Feb 24, 2024
5c6cd6f
test
rajpalc7 Feb 24, 2024
87b0188
test
rajpalc7 Feb 24, 2024
0447fb3
deployment
rajpalc7 Feb 26, 2024
6b89423
test
rajpalc7 Feb 26, 2024
e87c7ae
deployment
rajpalc7 Feb 26, 2024
3a9cb1c
test
rajpalc7 Feb 26, 2024
62d9bc1
test
rajpalc7 Feb 26, 2024
2f4f7b0
test
rajpalc7 Feb 26, 2024
cd48413
test
rajpalc7 Feb 26, 2024
0f21e23
test
rajpalc7 Feb 26, 2024
58d43c7
deployment
rajpalc7 Feb 26, 2024
8130561
final deployment
rajpalc7 Feb 26, 2024
c2a5fc0
test
rajpalc7 Feb 28, 2024
8d7e653
test
rajpalc7 Feb 28, 2024
c4a0fbe
test
rajpalc7 Feb 28, 2024
aff5195
test
rajpalc7 Feb 28, 2024
77be9fb
test
rajpalc7 Feb 28, 2024
f39664b
test
rajpalc7 Feb 28, 2024
513deb2
test
rajpalc7 Feb 28, 2024
9ec31a6
test
rajpalc7 Feb 28, 2024
092776e
test
rajpalc7 Feb 28, 2024
83f886d
test
rajpalc7 Feb 28, 2024
7ce469e
Deploy to dev
rajpalc7 Feb 28, 2024
6adeaaf
deployment with rocket chat notification
rajpalc7 Feb 28, 2024
51e2681
test
rajpalc7 Feb 29, 2024
7532412
deployment to dev and test
rajpalc7 Mar 11, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
113 changes: 113 additions & 0 deletions .github/workflows/actions/deploy/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
name: Deploy
description: Deploy to OpenShift namespace

inputs:
environment:
description: The environment to which the image will be deployed.
required: true

# Image parameters
ghcr_token:
description: The token to use to login to the GHCR.
required: true
github_image_name:
description: The name of the image in the GHCR to be deployed.
required: true
image_digest:
description: The digest of the image to be deployed. Identifies the unique image tag in the GHCR.
required: true
openshift_image_name:
description: The name of the image to use when pushing to OpenShift.
required: true

# OpenShift parameters
openshift_server_url:
description: The URL of the OpenShift server.
required: true
namespace:
description: The OpenShift namespace where the image is to be deployed.
required: true
deployment_configuration:
description: The name of the OpenShift deployment configuration triggered by the new image.
required: true
openshift_token:
description: The token used to authenticate with the OpenShift server.
required: true

# rocket.chat notification parameters
rocketchat_webhook:
description: The URL to use for posting notifications to rocket.chat.
required: true

runs:
using: composite
steps:
- name: Log in to the GHCR
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ inputs.ghcr_token }}

- name: Setup Openshift CLI
uses: redhat-actions/oc-login@v1
with:
openshift_server_url: ${{ inputs.openshift_server_url }}
openshift_token: ${{ inputs.openshift_token }}

- name: Login in to OpenShift container registry
shell: bash
env:
REGISTRY_AUTH_PREFERENCE: docker
run: |
oc version
docker version

# Openshift pipeline is currently running on 14.4.6 version and according to
# the new red hat article - https://access.redhat.com/articles/7042033
# the Podman auth configuration locations are preferred over Docker configuration locations.

# In order to avoid the "unauthorized: authentication required error" and
# make github actions job run successfully make sure when we try to login to openshift registry
# we need to define the oc registry login --to="${HOME}/.docker/config.json" in the oc login action step.

# This was not an issue when Openshift pipeline was running on 14.2 or 14.3 version
# but since Openshift upgraded to 14.4 version it started giving warning
# message : the default reading order of registry auth file will be changed from "${HOME}/.docker/config.json"
# to podman registry config locations in the future version of oc.
# "${HOME}/.docker/config.json" is deprecated, but can still be used for storing credentials
# as a fallback. See https://github.com/containers/image/blob/main/docs/containers-auth.json.5.md for the order
# of podman registry config locations.
oc registry login --to="${HOME}/.docker/config.json"

- name: Tag the image in the GHCR as ${{ inputs.environment }}
shell: bash
run: |
docker pull ${{ inputs.github_image_name }}@${{ inputs.image_digest }}
docker tag ${{ inputs.github_image_name }}@${{ inputs.image_digest }} ${{ inputs.github_image_name }}:${{ inputs.environment }}
docker push ${{ inputs.github_image_name }}:${{ inputs.environment }}

- name: Tag the image in the OpenShift container registry as ${{ inputs.environment }}
shell: bash
run: |
docker pull ${{ inputs.github_image_name }}@${{ inputs.image_digest }}
docker tag ${{ inputs.github_image_name }}@${{ inputs.image_digest }} ${{ inputs.openshift_image_name }}:${{ inputs.environment }}
docker push ${{ inputs.openshift_image_name}}:${{ inputs.environment }}

- name: Trigger OpenShift rollout
shell: bash
run: |
echo starting rollout in ${{ inputs.namespace }}
oc -n ${{ inputs.namespace }} rollout status dc/${{ inputs.deployment_configuration }} --watch

- name: Rocket.Chat Notification
uses: RocketChat/[email protected]
if: always()
with:
type: ${{ job.status }}
job_name: '*Deployment to ${{ inputs.environment }}*'
mention: 'here'
mention_if: 'failure'
channel: '#ditp-gha-notifications'
url: ${{ inputs.rocketchat_webhook }}
commit: true
Loading
Loading