Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add --atomic option for helm #26

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
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
41 changes: 21 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,26 @@ GitHub action for deploying to AWS EKS clusters using helm.

Following inputs can be used as `step.with` keys

| Name | Type | Description |
|---------------------------|--------|----------------------------------------------------------------------------------|
| `aws-secret-access-key` | String | AWS secret access key part of the aws credentials. This is used to login to EKS. |
| `aws-access-key-id` | String | AWS access key id part of the aws credentials. This is used to login to EKS. |
| `aws-region` | String | AWS region to use. This must match the region your desired cluster lies in. |
| `cluster-name` | String | The name of the desired cluster. |
| `cluster-role-arn` | String | If you wish to assume an admin role, provide the role arn here to login as. |
| `config-files` | String | Comma separated list of helm values files. |
| `namespace` | String | Kubernetes namespace to use. |
| `values` | String | Comma separates list of value set for helms. e.x: key1=value1,key2=value2 |
| `name` | String | The name of the helm release |
| `chart-path` | String | The path to the chart. (For local helm chart) |
| `chart-repository` | String | The URL of the chart repository. (For remote repo) |
| `chart-name` | String | Helm chart name inside the repository. (For remote repo) |
| `repo-username` | String | Username for repository basic auth |
| `repo-password` | String | Password for repository basic auth |
| `chart-version` | String | The version number of the chart |
| `helm-ecr-aws-account-id` | String | AWS account ID for the helm ECR |
| `helm-ecr-aws-region` | String | AWS region for the helm ECR |
| Name | Type | Description |
|---------------------------|---------|----------------------------------------------------------------------------------|
| `atomic` | Boolean | Roll the install/upgrade back in the face of failure. |
| `aws-secret-access-key` | String | AWS secret access key part of the aws credentials. This is used to login to EKS. |
| `aws-access-key-id` | String | AWS access key id part of the aws credentials. This is used to login to EKS. |
| `aws-region` | String | AWS region to use. This must match the region your desired cluster lies in. |
| `cluster-name` | String | The name of the desired cluster. |
| `cluster-role-arn` | String | If you wish to assume an admin role, provide the role arn here to login as. |
| `config-files` | String | Comma separated list of helm values files. |
| `namespace` | String | Kubernetes namespace to use. |
| `values` | String | Comma separates list of value set for helms. e.x: key1=value1,key2=value2 |
| `name` | String | The name of the helm release |
| `chart-path` | String | The path to the chart. (For local helm chart) |
| `chart-repository` | String | The URL of the chart repository. (For remote repo) |
| `chart-name` | String | Helm chart name inside the repository. (For remote repo) |
| `repo-username` | String | Username for repository basic auth |
| `repo-password` | String | Password for repository basic auth |
| `chart-version` | String | The version number of the chart |
| `helm-ecr-aws-account-id` | String | AWS account ID for the helm ECR |
| `helm-ecr-aws-region` | String | AWS region for the helm ECR |


## Example usage
Expand Down Expand Up @@ -101,4 +102,4 @@ with:
name: release_name
helm-ecr-aws-account-id: 111111111111111
helm-ecr-aws-region: us-west-2
```
```
9 changes: 7 additions & 2 deletions action.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
# action.yml
name: 'EKS Helm Deployment'
name: 'Helm Deploy to EKS'
description: 'Deploy a helm chart to EKS cluster.'
branding:
icon: anchor
color: yellow
inputs:
atomic:
description: 'Whether helm should roll back in the face of failure'
required: false
default: "false"
aws-secret-access-key:
description: 'AWS credentials used to login to eks.'
required: false
Expand Down Expand Up @@ -74,6 +78,7 @@ runs:
using: 'docker'
image: 'Dockerfile'
env:
ATOMIC: ${{ inputs.atomic }}
AWS_REGION: ${{ inputs.aws-region }}
AWS_SECRET_ACCESS_KEY: ${{ inputs.aws-secret-access-key }}
AWS_ACCESS_KEY_ID: ${{ inputs.aws-access-key-id }}
Expand All @@ -93,4 +98,4 @@ runs:
REPO_PASSWORD: ${{ inputs.repo-password }}
CHART_VERSION: ${{ inputs.chart-version }}
HELM_ECR_AWS_ACCOUNT_ID: ${{ inputs.helm-ecr-aws-account-id }}
HELM_ECR_AWS_REGION: ${{ inputs.helm-ecr-aws-region }}
HELM_ECR_AWS_REGION: ${{ inputs.helm-ecr-aws-region }}
4 changes: 4 additions & 0 deletions deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ for config_file in ${DEPLOY_CONFIG_FILES//,/ }; do
UPGRADE_COMMAND="${UPGRADE_COMMAND} -f ${config_file}"
done

if [ ${ATOMIC} == "true" ]; then
UPGRADE_COMMAND="${UPGRADE_COMMAND} --atomic"
fi

if [ -n "$DEPLOY_NAMESPACE" ]; then
UPGRADE_COMMAND="${UPGRADE_COMMAND} -n ${DEPLOY_NAMESPACE}"
fi
Expand Down