Skip to content

Commit

Permalink
fix: Adjust docker and helm composite actions as per the requirements…
Browse files Browse the repository at this point in the history
… of the helm image values

Signed-off-by: Dimitris Kargatzis <[email protected]>
  • Loading branch information
dkargatzis committed Mar 9, 2024
1 parent 27ffa7f commit ed92efe
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,7 @@ jobs:
namespace: ${{ env.NAMESPACE }}
helm_path: ${{ env.HELM_PATH }}
environment: ${{ env.ENVIRONMENT }}
registry_url: ${{ steps.configure_aws.outputs.registry_url }}
image_name: ${{ env.IMAGE_NAME }}
image_uri: ${{ steps.build_and_deploy.outputs.image_uri }}
image_tag: ${{ steps.build_and_deploy.outputs.image_tag }}
public_url: ${{ env.PUBLIC_URL }}
port: ${{ env.PORT }}
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,11 @@ inputs:
description: 'Name of the image to build and push'
required: true
outputs:
image_uri:
description: 'The URI pointing to the location of the Docker image in the container registry. This URI includes both the registry URL and the image name.'
value: ${{ steps.build.outputs.image_uri }}
image_tag:
description: 'The tag of the image pushed to the container registry'
description: 'A specific identifier associated with the version of the Docker image that was pushed to the container registry.'
value: ${{ steps.tag.outputs.image_tag }}

runs:
Expand All @@ -23,18 +26,25 @@ runs:
github_sha="${{ github.sha }}"
version_date=$(date +'%Y%m%d%H%M%S')
version_tag="${github_sha::7}-${version_date}"
image_tag="${{ inputs.registry_url }}/${{ inputs.image_name }}:${version_tag}"
echo "image_tag=${image_tag}" >> $GITHUB_ENV
echo "::set-output name=image_tag::${image_tag}"
echo "version_tag=${version_tag}" >> $GITHUB_ENV
echo "::set-output name=image_tag::${version_tag}"
shell: bash

# Build the Docker image
# Generate the full image URI
- name: Generate image URI
id: build
run: |-
image_uri="${{ inputs.registry_url }}/${{ inputs.image_name }}"
echo "image_uri=${image_uri}" >> $GITHUB_ENV
echo "::set-output name=image_uri::${image_uri}"
shell: bash

# Build the Docker image with the generated tag
- name: Build Docker image
run: docker build --tag ${{ env.image_tag }} .
run: docker build --tag ${{ env.image_uri }}:${{ env.version_tag }} .
shell: bash

# Push the Docker image to the registry
- name: Push Docker image to registry
id: push
run: docker push ${{ env.image_tag }}
run: docker push ${{ env.image_uri }}:${{ env.version_tag }}
shell: bash
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,11 @@ inputs:
namespace:
description: 'The organization to be used for the namespace in helm install'
required: true
registry_url:
description: 'URL of the container registry'
required: true
image_name:
description: 'Name of the image to build and push'
image_uri:
description: 'URI of the Docker image in the container registry. Helm will use this to pull the image.'
required: true
image_tag:
description: 'The tag of the image pushed to the container registry'
description: 'Specific tag of the Docker image to be deployed. Allows for precise version control.'
required: true
public_url:
description: 'Public URL to used for exposing the service'
Expand All @@ -38,16 +35,16 @@ runs:
ENVIRONMENT: ${{ inputs.environment }}
RELEASE_NAME: ${{ inputs.release_name }}
NAMESPACE: ${{ inputs.namespace }}
IMAGE_REPO: ${{ inputs.registry_url }}/${{ inputs.image_name }}
IMAGE_URI: ${{ inputs.image_uri }}
IMAGE_TAG: ${{ inputs.image_tag }}
PUBLIC_URL: ${{ inputs.public_url }}
PORT: ${{ inputs.port }}
HELM_PATH: ${{ inputs.helm_path }}
run: |-
helm upgrade ${{ env.RELEASE_NAME }} ${{ env.HELM_PATH }} --namespace ${{ env.NAMESPACE }} --create-namespace --wait \
--values ${{ env.HELM_PATH }}/values-${{ env.ENVIRONMENT }}.yaml \
--set image.repository=$IMAGE_REPO \
--set image.tag=$IMAGE_TAG \
--set image.repository=${{ env.IMAGE_URI }} \
--set image.tag=${{ env.IMAGE_TAG }} \
--set cert.tls.secretName=$RELEASE_NAME \
--set cert.commonName=$PUBLIC_URL \
--set cert.dnsNames.hosts={$PUBLIC_URL} \
Expand Down

0 comments on commit ed92efe

Please sign in to comment.