Skip to content
Merged
Show file tree
Hide file tree
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
7 changes: 5 additions & 2 deletions .github/workflows/create-git-and-image-tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,5 +58,8 @@ jobs:
oc login --token=${{ env.OPENSHIFT_TOKEN }} --server=${{ env.OPENSHIFT_SERVER }}
oc project ${{ env.OPENSHIFT_NAMESPACE }}

oc tag ${{ env.OPENSHIFT_NAMESPACE }}/${{ env.REPO_NAME }}-${{ env.APP_NAME_BACKEND }}-${{ env.BRANCH }}:latest \
${{ env.OPENSHIFT_NAMESPACE }}/${{ env.REPO_NAME }}-${{ env.APP_NAME_BACKEND }}-${{ env.BRANCH }}:${{ github.event.inputs.version }}
BRANCH_DOWNCASE=$(echo '${{ env.BRANCH }}' | tr '[A-Z]' '[a-z]')

oc tag \
${{ env.OPENSHIFT_NAMESPACE }}/${{ env.REPO_NAME }}-${{ env.APP_NAME_BACKEND }}-$BRANCH_DOWNCASE:latest \
${{ env.OPENSHIFT_NAMESPACE }}/${{ env.REPO_NAME }}-${{ env.APP_NAME_BACKEND }}-$BRANCH_DOWNCASE:{{ github.event.inputs.version }}
8 changes: 6 additions & 2 deletions .github/workflows/deploy-to-openshift-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -149,18 +149,22 @@ jobs:
oc rollout cancel deployment/${{ env.APP_NAME }}-${{ env.APP_NAME_BACKEND }}-${{ env.APP_ENVIRONMENT }} 2> /dev/null \
|| true && echo "No rollout in progress"

BRANCH_DOWNCASE=$(echo '${{ env.BRANCH }}' | tr '[A-Z]' '[a-z]')

# Create the image stream if it doesn't exist
oc create imagestream ${{ env.IMAGE_NAME }} 2> /dev/null || true && echo "D365 API image stream in place"

oc tag ${{ steps.push-image-backend.outputs.registry-path }} \
${{ env.IMAGE_NAME }}-${{ env.BRANCH }}:${{ env.TAG }}
oc tag \
${{ steps.push-image-backend.outputs.registry-path }} \
${{ env.IMAGE_NAME }}-$BRANCH_DOWNCASE:${{ env.TAG }}

# Process and apply deployment template
oc process \
-f tools/openshift/d365api.deployment.yaml \
-p APP_NAME=${{ env.APP_NAME }} \
-p REPO_NAME=${{ env.REPO_NAME }} \
-p BRANCH=${{ env.BRANCH }} \
-p BRANCH_DOWNCASE="$BRANCH_DOWNCASE" \
-p NAMESPACE=${{ env.OPENSHIFT_NAMESPACE }} \
-p TAG=${{ env.TAG }} \
-p MIN_REPLICAS=${{ env.MIN_REPLICAS }} \
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/deploy-to-openshift-efx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -123,15 +123,20 @@ jobs:
# Create the image stream if it doesn't exist
oc create imagestream ${{ env.IMAGE_NAME }} 2> /dev/null || true && echo "D365 API image stream in place"

BRANCH_DOWNCASE=$(echo '${{ env.BRANCH }}' | tr '[A-Z]' '[a-z]')

# Create tag for EFX env from DEV env image
oc tag ${{ env.NAMESPACE }}-dev/${{ env.IMAGE_NAME }}-${{ env.BRANCH }}:${{ inputs.tag }} ${{ env.NAMESPACE }}-test/${{ env.IMAGE_NAME }}-${{ env.BRANCH }}:${{ inputs.tag }}
oc tag \
${{ env.NAMESPACE }}-dev/${{ env.IMAGE_NAME }}-$BRANCH_DOWNCASE:${{ inputs.tag }} \
${{ env.NAMESPACE }}-test/${{ env.IMAGE_NAME }}-$BRANCH_DOWNCASE:${{ inputs.tag }}

# Process and apply deployment template
oc process \
-f tools/openshift/d365api.deployment.yaml \
-p APP_NAME=${{ env.APP_NAME }} \
-p REPO_NAME=${{ env.REPO_NAME }} \
-p BRANCH=${{ env.BRANCH }} \
-p BRANCH_DOWNCASE="$BRANCH_DOWNCASE" \
-p NAMESPACE=${{ env.OPENSHIFT_NAMESPACE }} \
-p TAG=${{ inputs.tag }} \
-p MIN_REPLICAS=${{ env.MIN_REPLICAS }} \
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/deploy-to-openshift-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -123,15 +123,20 @@ jobs:
# Create the image stream if it doesn't exist
oc create imagestream ${{ env.IMAGE_NAME }} 2> /dev/null || true && echo "D365 API image stream in place"

BRANCH_DOWNCASE=$(echo '${{ env.BRANCH }}' | tr '[A-Z]' '[a-z]')

# Create tag for PROD env from DEV env image
oc tag ${{ env.NAMESPACE }}-dev/${{ env.IMAGE_NAME }}-${{ env.BRANCH }}:${{ inputs.tag }} ${{ env.NAMESPACE }}-prod/${{ env.IMAGE_NAME }}-${{ env.BRANCH }}:${{ inputs.tag }}
oc tag \
${{ env.NAMESPACE }}-dev/${{ env.IMAGE_NAME }}-$BRANCH_DOWNCASE:${{ inputs.tag }} \
${{ env.NAMESPACE }}-prod/${{ env.IMAGE_NAME }}-$BRANCH_DOWNCASE:${{ inputs.tag }}

# Process and apply deployment template
oc process \
-f tools/openshift/d365api.deployment.yaml \
-p APP_NAME=${{ env.APP_NAME }} \
-p REPO_NAME=${{ env.REPO_NAME }} \
-p BRANCH=${{ env.BRANCH }} \
-p BRANCH_DOWNCASE="$BRANCH_DOWNCASE" \
-p NAMESPACE=${{ env.OPENSHIFT_NAMESPACE }} \
-p TAG=${{ inputs.tag }} \
-p MIN_REPLICAS=${{ env.MIN_REPLICAS }} \
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/deploy-to-openshift-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -119,12 +119,15 @@ jobs:
oc rollout cancel deployment/${{ env.APP_NAME }}-${{ env.APP_NAME_BACKEND }} 2> /dev/null \
|| true && echo "No rollout in progress"

BRANCH_DOWNCASE=$(echo '${{ env.BRANCH }}' | tr '[A-Z]' '[a-z]')

# Process and apply deployment template
oc process \
-f tools/openshift/d365api.deployment.yaml \
-p APP_NAME=${{ env.APP_NAME }} \
-p REPO_NAME=${{ env.REPO_NAME }} \
-p BRANCH=${{ env.BRANCH }} \
-p BRANCH_DOWNCASE="$BRANCH_DOWNCASE" \
-p NAMESPACE=${{ env.OPENSHIFT_NAMESPACE }} \
-p TAG=${{ inputs.tag }} \
-p MIN_REPLICAS=${{ env.MIN_REPLICAS }} \
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/deploy-to-openshift-uat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -123,15 +123,20 @@ jobs:
# Create the image stream if it doesn't exist
oc create imagestream ${{ env.IMAGE_NAME }} 2> /dev/null || true && echo "D365 API image stream in place"

BRANCH_DOWNCASE=$(echo '${{ env.BRANCH }}' | tr '[A-Z]' '[a-z]')

# Create tag for UAT env from DEV env image
oc tag ${{ env.NAMESPACE }}-dev/${{ env.IMAGE_NAME }}-${{ env.BRANCH }}:${{ inputs.tag }} ${{ env.NAMESPACE }}-test/${{ env.IMAGE_NAME }}-${{ env.BRANCH }}:${{ inputs.tag }}
oc tag \
${{ env.NAMESPACE }}-dev/${{ env.IMAGE_NAME }}-$BRANCH_DOWNCASE:${{ inputs.tag }} \
${{ env.NAMESPACE }}-test/${{ env.IMAGE_NAME }}-$BRANCH_DOWNCASE:${{ inputs.tag }}

# Process and apply deployment template
oc process \
-f tools/openshift/d365api.deployment.yaml \
-p APP_NAME=${{ env.APP_NAME }} \
-p REPO_NAME=${{ env.REPO_NAME }} \
-p BRANCH=${{ env.BRANCH }} \
-p BRANCH_DOWNCASE="$BRANCH_DOWNCASE" \
-p NAMESPACE=${{ env.OPENSHIFT_NAMESPACE }} \
-p TAG=${{ inputs.tag }} \
-p MIN_REPLICAS=${{ env.MIN_REPLICAS }} \
Expand Down
5 changes: 4 additions & 1 deletion tools/openshift/d365api.deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ objects:
app: '${APP_NAME}-d365api-${ENVIRONMENT}'
spec:
containers:
- image: image-registry.openshift-image-registry.svc:5000/${NAMESPACE}/${REPO_NAME}api-${BRANCH}:${TAG}
- image: image-registry.openshift-image-registry.svc:5000/${NAMESPACE}/${REPO_NAME}api-${BRANCH_DOWNCASE}:${TAG}
imagePullPolicy: Always
volumeMounts:
# - name: tls-certs
Expand Down Expand Up @@ -156,6 +156,9 @@ parameters:
- name: BRANCH
description: Job identifier (i.e. 'pr-5' OR 'master')
required: true
- name: BRANCH_DOWNCASE
description: Job identifier (i.e. 'pr-5' OR 'master'), but in lowercase letters only
required: true
- name: NAMESPACE
description: Target namespace reference (i.e. 'k8vopl-dev')
required: true
Expand Down
Loading