Skip to content

Commit

Permalink
[DEVOPS-236] Use release in Docker image registry image tag (#52)
Browse files Browse the repository at this point in the history
<details open>
<summary><a href="https://amuniversal.atlassian.net/browse/DEVOPS-236"
title="DEVOPS-236" target="_blank">DEVOPS-236</a></summary>
  <br />
  <table>
    <tr>
      <th>Summary</th>
<td>Switch to using semantic versioning on Azure Container Registry
image tags</td>
    </tr>
    <tr>
      <th>Type</th>
      <td>
<img alt="Bug"
src="https://amuniversal.atlassian.net/rest/api/2/universal_avatar/view/type/issuetype/avatar/10308?size=medium"
/>
        Bug
      </td>
    </tr>
    <tr>
      <th>Status</th>
      <td>Peer Review</td>
    </tr>
    <tr>
      <th>Points</th>
      <td>N/A</td>
    </tr>
    <tr>
      <th>Labels</th>
      <td>-</td>
    </tr>
  </table>
</details>
<!--
do not remove this marker as it will break action-jira-linter's
functionality.
  added_by_jira_lint
-->
---

<!--
We appreciate the effort for this pull request but before that please
make sure you read the contribution guidelines, then fill out the blanks
below.

Please format the PR title appropriately based on the type of change:
  [<issue>]: <description>
Where <issue> is the related Jira Issue Key.
-->

## Description

- Modified AKS deploy to automatically tag images as "latest" and for
staging and production deploys, the major release version like so:

![image](https://github.com/Andrews-McMeel-Universal/reusable_workflows/assets/111298136/a999b768-e18f-454c-89a3-0920914aa725)

## Related Issues

<!-- List any related Jira issues here -->

- Jira Issue: DEVOPS-236
- Testing environment: [![Staging AKS
Deploy](https://github.com/Andrews-McMeel-Universal/reusable_workflows-test/actions/workflows/aks-staging.yml/badge.svg)](https://github.com/Andrews-McMeel-Universal/reusable_workflows-test/actions/workflows/aks-staging.yml)
  • Loading branch information
ebronson68 committed Aug 15, 2023
1 parent 5b5233a commit 53faea8
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions .github/workflows/aks-deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ on:
required: false
type: string
description: "Docker image tag."
default: "${{ github.sha }}"
default: "${{ github.event.release.tag_name || github.sha }}"
maximumReplicas:
required: false
type: string
Expand Down Expand Up @@ -238,8 +238,12 @@ jobs:

- name: Build & Push Docker Image
run: |
docker build ${{ inputs.dockerFilePath }} ${{ env.buildArguments }} -t "${{ secrets.registryHostName }}/${{ inputs.dockerImageName }}:${{ inputs.dockerImageTag }}"
docker push "${{ secrets.registryHostName }}/${{ inputs.dockerImageName }}:${{ inputs.dockerImageTag }}"
docker build ${{ inputs.dockerFilePath }} ${{ env.buildArguments }} -t "${{ secrets.registryHostName }}/${{ inputs.dockerImageName }}:${{ inputs.dockerImageTag }}" -t "${{ secrets.registryHostName }}/${{ inputs.dockerImageName }}:latest"
if [[ "${{ inputs.dockerImageTag }}" == "${{ github.event.release.tag_name }}" ]]; then
MAJOR_RELEASE=$(echo "${{ github.event.release.tag_name }}" | cut -d "." -f 1)
docker tag "${{ secrets.registryHostName }}/${{ inputs.dockerImageName }}:${{ inputs.dockerImageTag }}" "${{ secrets.registryHostName }}/${{ inputs.dockerImageName }}:${MAJOR_RELEASE}"
fi
docker push -a "${{ secrets.registryHostName }}/${{ inputs.dockerImageName }}"
- name: Create values override file
run: |
Expand Down

0 comments on commit 53faea8

Please sign in to comment.