Skip to content

Commit

Permalink
Add support for S3 repo (#43)
Browse files Browse the repository at this point in the history
* Add support for S3 in script

* Adding S3 example to README

* Bumping README versions example and alpine/k8s version
  • Loading branch information
LeoDiazL authored Oct 3, 2023
1 parent 690916f commit 1127005
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM alpine/k8s:1.26.1
FROM alpine/k8s:1.26.9

COPY deploy.sh /usr/local/bin/deploy

Expand Down
32 changes: 25 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ Following inputs can be used as `step.with` keys

```yaml
- name: Deploy Helm
uses: bitovi/[email protected].5
uses: bitovi/[email protected].7
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
Expand All @@ -71,7 +71,7 @@ Following inputs can be used as `step.with` keys
## Example 2 - Custom Chart Repo
```yaml
- name: Deploy Helm
uses: bitovi/[email protected].5
uses: bitovi/[email protected].7
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
Expand All @@ -90,7 +90,7 @@ Following inputs can be used as `step.with` keys
## Example 3 - OCI Chart Repo
```yaml
- name: Deploy Helm
uses: bitovi/[email protected].5
uses: bitovi/[email protected].7
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
Expand All @@ -113,7 +113,7 @@ Following inputs can be used as `step.with` keys
aws-region: ${{ env.aws-region }}

- name: Install Helm Chart
uses: bitovi/[email protected].5
uses: bitovi/[email protected].7
with:
aws-region: ${{ env.aws-region }}
cluster-name: eks-cluster-${{ env.environment }}
Expand All @@ -123,7 +123,7 @@ Following inputs can be used as `step.with` keys
## Example 5 - Use secrets with vals backend
```yaml
- name: Deploy Helm
uses: bitovi/[email protected].5
uses: bitovi/[email protected].7
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
Expand All @@ -138,11 +138,29 @@ Following inputs can be used as `step.with` keys
plugins: https://github.com/jkroepke/helm-secrets
```
## Example 6 - Use with S3 as repo
```yaml
- name: Deploy S3 Helm chart
uses: bitovi/[email protected]
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-west-2
chart-repository: s3://my-s3-bucket/
chart-path: my-service/my-service
version: 0.1.0
cluster-name: mycluster
namespace: dev
name: my_service_name
plugins: https://github.com/hypnoglow/helm-s3.git
```
* See the [official AWS Guide](https://docs.aws.amazon.com/prescriptive-guidance/latest/patterns/set-up-a-helm-v3-chart-repository-in-amazon-s3.html) on how to set this up.
## Example Uninstall
```yaml
- name: Deploy Helm
uses: bitovi/[email protected].5
uses: bitovi/[email protected].7
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
Expand All @@ -157,7 +175,7 @@ Following inputs can be used as `step.with` keys
```yaml
- name: Deploy Helm
uses: bitovi/[email protected].5
uses: bitovi/[email protected].7
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
Expand Down
4 changes: 2 additions & 2 deletions deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ OCI_REGISTRY=false
# Check repository type

if [ -n "${HELM_REPOSITORY}" ]; then
if [[ ${HELM_REPOSITORY} =~ ^http.* ]]; then
if [[ ${HELM_REPOSITORY} =~ ^http.* ]] || [[ ${HELM_REPOSITORY} =~ ^s3.* ]]; then
OCI_REGISTRY=false
else
if [[ ${HELM_REPOSITORY} =~ ^oci.* ]]; then
OCI_REGISTRY=true
else
echo "::error::Protocol handler expected here. Need http or oci."
echo "::error::Protocol handler expected here. Need http, s3 or oci."
exit 1
fi
fi
Expand Down

0 comments on commit 1127005

Please sign in to comment.