diff --git a/.github/workflows/aws-build-push-and-deploy-to-eks-with-helm.yaml b/.github/workflows/aws-build-push-and-deploy-to-eks-with-helm.yaml index b80ee6d..8873f0c 100644 --- a/.github/workflows/aws-build-push-and-deploy-to-eks-with-helm.yaml +++ b/.github/workflows/aws-build-push-and-deploy-to-eks-with-helm.yaml @@ -46,17 +46,18 @@ jobs: deploy: name: Setup, Build and Publish Docker image to ECR, and Deploy to EKS using Helm runs-on: ubuntu-latest + environment: ${{ inputs.environment }} env: BRANCH: ${{ github.head_ref || github.ref_name }} - ENVIRONMENT: ${{ github.event.inputs.environment }} - REGION: ${{ github.event.inputs.region }} - IMAGE_NAME: ${{ github.event.inputs.image_name }} - EKS_CLUSTER: ${{ github.event.inputs.eks_cluster }} - NAMESPACE: ${{ github.event.inputs.namespace }} - RELEASE_NAME: ${{ github.event.inputs.release_name }} - PUBLIC_URL: ${{ github.event.inputs.public_url }} - PORT: ${{ github.event.inputs.port }} - HELM_PATH: ${{ github.event.inputs.helm_path }} + ENVIRONMENT: ${{ inputs.environment }} + REGION: ${{ inputs.region }} + IMAGE_NAME: ${{ inputs.image_name }} + EKS_CLUSTER: ${{ inputs.eks_cluster }} + NAMESPACE: ${{ inputs.namespace }} + RELEASE_NAME: ${{ inputs.release_name }} + PUBLIC_URL: ${{ inputs.public_url }} + PORT: ${{ inputs.port }} + HELM_PATH: ${{ inputs.helm_path }} JOB_STATUS: succeeded # Add "id-token" with the intended permissions. diff --git a/ci-cd-and-automation/github/composite-actions/aws-configure/action.yaml b/ci-cd-and-automation/github/composite-actions/aws-configure/action.yaml index b520419..5dcd0d4 100644 --- a/ci-cd-and-automation/github/composite-actions/aws-configure/action.yaml +++ b/ci-cd-and-automation/github/composite-actions/aws-configure/action.yaml @@ -2,63 +2,62 @@ name: 'Configure AWS' description: 'Configures AWS credentials, authenticates to ECR and creates AWS profile' inputs: - aws-access-key-id: + aws_access_key_id: description: 'AWS Access Key ID' required: true - aws-secret-access-key: + aws_secret_access_key: description: 'AWS Secret Access Key' required: true - aws-region: + aws_region: description: 'The region on AWS to host the workspace resources in' required: true - eks-cluster: + eks_cluster: description: 'The name of the EKS cluster on AWS' required: true outputs: - registry-url: + registry_url: description: 'The URL of the Container Registry in AWS' - value: ${{ steps.construct-registry-url.outputs.registry-url }} + value: ${{ steps.construct_registry_url.outputs.registry_url }} runs: using: "composite" steps: # Configure AWS credentials - name: Configure AWS credentials + id: configure_aws_credentials uses: aws-actions/configure-aws-credentials@v4 with: - aws-access-key-id: ${{ inputs.aws-access-key-id }} - aws-secret-access-key: ${{ inputs.aws-secret-access-key }} - aws-region: ${{ inputs.aws-region }} + aws-access-key-id: ${{ inputs.aws_access_key_id }} + aws-secret-access-key: ${{ inputs.aws_secret_access_key }} + aws-region: ${{ inputs.aws_region }} # Configure authentication to ECR - name: Authenticate to ECR - id: ecr uses: jwalton/gh-ecr-login@v1 with: - access-key-id: ${{ inputs.aws-access-key-id }} - secret-access-key: ${{ inputs.aws-secret-access-key }} - region: ${{ inputs.aws-region }} + access-key-id: ${{ inputs.aws_access_key_id }} + secret-access-key: ${{ inputs.aws_secret_access_key }} + region: ${{ inputs.aws_region }} # Create profile for AWS interface - name: Create the default profile for EKS/ECR interface run: |- - aws configure set aws_access_key_id ${{ inputs.aws-access-key-id }} - aws configure set aws_secret_access_key ${{ inputs.aws-secret-access-key }} + aws configure set aws_access_key_id ${{ inputs.aws_access_key_id }} + aws configure set aws_secret_access_key ${{ inputs.aws_secret_access_key }} shell: bash # Construct the ECR registry URL - name: Construct ECR Registry URL - id: construct-registry-url + id: construct_registry_url run: |- - registry_url="${{ inputs.aws-account-id }}.dkr.ecr.${{ inputs.aws-region }}.amazonaws.com" + registry_url="${{ steps.configure_aws_credentials.outputs.aws-account-id }}.dkr.ecr.${{ inputs.aws_region }}.amazonaws.com" echo "registry_url=$registry_url" >> $GITHUB_ENV - echo "::set-output name=registry-url::$registry_url" + echo "::set-output name=registry_url::$registry_url" shell: bash # Update kube-config for EKS cluster - name: Config kubectl - id: kube-config - run: | + run: |- # Update kube-config for EKS cluster - aws eks --region ${{ inputs.aws-region }} update-kubeconfig --name ${{ inputs.eks-cluster }} + aws eks --region ${{ inputs.aws_region }} update-kubeconfig --name ${{ inputs.eks_cluster }} shell: bash diff --git a/ci-cd-and-automation/github/composite-actions/docker-build-and-push/action.yaml b/ci-cd-and-automation/github/composite-actions/docker-build-and-push/action.yaml index 845825e..869d761 100644 --- a/ci-cd-and-automation/github/composite-actions/docker-build-and-push/action.yaml +++ b/ci-cd-and-automation/github/composite-actions/docker-build-and-push/action.yaml @@ -2,16 +2,16 @@ name: 'Build and push Docker image' description: 'Build and push Docker image to a container registry, assuming authentication is handled separately' inputs: - image-name: - description: 'Name of the image to build and push' - required: true - registry-url: + registry_url: description: 'URL of the container registry' required: true + image_name: + description: 'Name of the image to build and push' + required: true outputs: - image-tag: + image_tag: description: 'The tag of the image pushed to the container registry' - value: ${{ steps.push.outputs.image-tag }} + value: ${{ steps.tag.outputs.image_tag }} runs: using: "composite" @@ -23,21 +23,18 @@ 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}" - # Set the environment variables + 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 "::set-output name=image_tag::${image_tag}" shell: bash # Build the Docker image - name: Build Docker image - run: |- - docker build --tag ${{ env.image_tag }} . + run: docker build --tag ${{ env.image_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_tag }} shell: bash diff --git a/ci-cd-and-automation/github/composite-actions/helm-install-local-chart/action.yaml b/ci-cd-and-automation/github/composite-actions/helm-install-local-chart/action.yaml index 3dcfe4f..0c761a3 100644 --- a/ci-cd-and-automation/github/composite-actions/helm-install-local-chart/action.yaml +++ b/ci-cd-and-automation/github/composite-actions/helm-install-local-chart/action.yaml @@ -35,7 +35,7 @@ runs: # Install or Upgrade the Helm release - name: Install or upgrade helm release env: - ENVIRONMENT: ${{ github.event.inputs.environment }} + ENVIRONMENT: ${{ inputs.environment }} RELEASE_NAME: ${{ inputs.release_name }} NAMESPACE: ${{ inputs.namespace }} IMAGE_REPO: ${{ inputs.registry_url }}/${{ inputs.image_name }}