Reputation: 1
Im trying to create a github action which will push to ECR , how do I push helm chart to ECR with Actions yaml?
Upvotes: 0
Views: 2827
Reputation: 933
Here's a custom action that utilizes the steps described above.
name: AWS Helm
description: AWS Setup and Helm Chart
inputs:
aws-access-key-id:
description: The AWS access Key id
required: true
aws-secret-access-key:
description: The AWS access key
required: true
ecr-repository-name:
description: the name of the ecr repository
required: true
aws-region:
description: The AWS region, default us-east-2
default: us-east-2
required: false
tag-name:
description: image tag name
required: true
chart-path:
description: the directory path to the specified chart
required: true
runs:
using: "composite"
steps:
- uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ inputs.aws-access-key-id }}
aws-secret-access-key: ${{ inputs.aws-secret-access-key }}
aws-region: ${{ inputs.aws-region }}
# This is an un-official build that allows helm login to the ECR
- uses: aws-actions/amazon-ecr-login@arjraman
id: login-ecr
- name: Helm Chart
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
ECR_REPOSITORY: ${{ inputs.ecr-repository-name }}
run : |
helm package \
${{ inputs.chart-path }} \
--app-version ${{ inputs.tag-name }} \
--version ${{ inputs.tag-name }}
helm push "${{ inputs.ecr-repository-name }}-${{ inputs.tag-name }}.tgz" oci://$ECR_REGISTRY
shell: bash
Upvotes: 1
Reputation: 5263
aws ecr get-login-password \
--region <aws-region> | helm registry login \
--username AWS \
--password-stdin <aws-account-id>.dkr.ecr.<aws-region>.amazonaws.com
helm chart push <aws-account-id>.dkr.ecr.<aws-region>.amazonaws.com/<ecr-repo>:mychart
Upvotes: 0