Skip to content

Commit

Permalink
Fix chart test CI (#81)
Browse files Browse the repository at this point in the history
  • Loading branch information
Embraser01 authored Mar 27, 2022
1 parent e9c594c commit eb23bf5
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 36 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/helmchart-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ name: Release Charts
on:
push:
branches: [master]
paths:
- 'charts/**'
- '.github/workflows/helmchart-release.yml'

jobs:
release:
Expand Down
48 changes: 20 additions & 28 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,18 @@ jobs:

- name: Docker meta
id: docker_meta
uses: crazy-max/ghaction-docker-meta@v1
uses: docker/metadata-action@v3
with:
images: caddy/ingress
tag-sha: true
tags: |
type=semver,pattern={{raw}}
type=ref,event=branch
type=ref,event=pr
type=sha
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Cache Docker layers
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Login to DockerHub
uses: docker/login-action@v1
with:
Expand All @@ -46,8 +42,8 @@ jobs:
push: true
tags: ${{ steps.docker_meta.outputs.tags }}
labels: ${{ steps.docker_meta.outputs.labels }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
cache-from: type=gha
cache-to: type=gha,mode=max

lint-test:
name: Test and lint charts
Expand All @@ -60,29 +56,25 @@ jobs:
with:
fetch-depth: 0

- name: Set up chart-testing
uses: helm/chart-testing-action@v2.0.1
- name: Set up Helm
uses: azure/setup-helm@v1
with:
version: v3.8.1

- name: Run chart-testing (list-changed)
id: list-changed
run: |
changed=$(ct list-changed)
if [[ -n "$changed" ]]; then
echo "::set-output name=changed::true"
fi
- uses: actions/setup-python@v2
with:
python-version: 3.7

- name: Set up chart-testing
uses: helm/chart-testing-action@v2.2.1

- name: Run chart-testing (lint)
run: ct lint
run: ct lint --config ct.yaml

- name: Create kind cluster
uses: helm/kind-action@v1.1.0
with:
version: "v0.9.0"
# Only build a kind cluster if there are chart changes to test.
if: steps.list-changed.outputs.changed == 'true'
uses: helm/kind-action@v1.2.0

- name: Install MetalLB to allow LoadBalancer services
if: steps.list-changed.outputs.changed == 'true'
run: |
kubectl create ns metallb-system
kubectl apply -f https://raw.githubusercontent.com/google/metallb/v0.9.3/manifests/metallb.yaml
Expand Down
13 changes: 13 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,16 @@ curl -H 'Host: example2.kubernetes.localhost http://127.0.0.1:80/hello2
- You can change local port forwarded by skaffold by changing the port values in the `skaffold.yaml` file on section `portForward` `localPort`. Remind that you can forward only port greather than 1024 if you execute it as non root user
- You can delete your local cluster with the command `kind delete cluster`
- To use TLS your domain should be publically resolved to your cluster IP in order to allow Let's Encript to validate the domain

## Releasing new helm chart version

If you want to release a new version of the `caddy-ingress-controller` chart, you'll need
to create a new PR with:
- The new chart's `version` in `Chart.yaml`
- The new `image.tag` in `values.yaml` (if you want to update the default image used in the chart)
- The new `appVersion` in `Chart.yaml` (if you did the previous line)

## Releasing a new app version

To release a new caddy-ingress-controller image, you need to create a new semver tag.
It will build and push an image to https://hub.docker.com/r/caddy/ingress.
1 change: 1 addition & 0 deletions charts/caddy-ingress-controller/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ description: A helm chart for the Caddy Kubernetes ingress controller
icon: https://caddyserver.com/resources/images/caddy-circle-lock.svg
type: application
version: 0.0.1-rc4
appVersion: "0.1.0"
keywords:
- ingress-controller
- caddyserver
Expand Down
2 changes: 1 addition & 1 deletion charts/caddy-ingress-controller/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ minikube: false
image:
repository: caddy/ingress
pullPolicy: IfNotPresent
tag: "latest"
tag: "v0.1.0"

imagePullSecrets: []
nameOverride: ""
Expand Down
7 changes: 0 additions & 7 deletions ct.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
# See https://github.com/helm/chart-testing#configuration
remote: origin
validate-maintainers: true
validate-chart-schema: true
validate-yaml: true
check-version-increment: true
all: true
chart-dirs:
- charts
helm-extra-args: --timeout 600s

0 comments on commit eb23bf5

Please sign in to comment.