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

Making workflow changes to support deployment as per 14.4.6 version #35

Merged
merged 1 commit into from
Jan 18, 2024
Merged
Changes from all commits
Commits
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
37 changes: 33 additions & 4 deletions .github/workflows/actions/deploy/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,17 @@ runs:
username: ${{ github.actor }}
password: ${{ inputs.ghcr_token }}

- name: Install CLI tools from OpenShift Mirror
uses: redhat-actions/openshift-tools-installer@v1
with:

# "mirror" is the default source, so this is optional.
source: "mirror"

# Installs the latest release of oc with the major version 3.
# This is equivalent to "3.x" or "^3".
oc: "4.14.6"

- name: Setup Openshift CLI
uses: redhat-actions/oc-login@v1
with:
Expand All @@ -58,8 +69,26 @@ runs:
- name: Login in to OpenShift container registry
shell: bash
run: |
oc registry login
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: |
Expand All @@ -72,7 +101,7 @@ runs:
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 }}
docker --debug --log-level=debug push ${{ inputs.openshift_image_name }}:${{ inputs.environment }}

- name: Trigger OpenShift rollout
shell: bash
Expand All @@ -88,6 +117,6 @@ runs:
job_name: '*Deployment to ${{ inputs.environment }}*'
mention: 'here'
mention_if: 'failure'
channel: '#test-gha'
channel: '#ditp-gha-notifications'
url: ${{ inputs.rocketchat_webhook }}
commit: true
commit: true
Loading