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

remove hack/workaround for tekton bug that was creating multiple tekton tasks that has been fixed in latest tekton release #9

Merged
merged 5 commits into from
Jun 23, 2021
Merged
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
21 changes: 21 additions & 0 deletions .github/scripts/configure-kube.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash

echo "Install ingress controller"
helm repo add haproxy-ingress https://haproxy-ingress.github.io/charts
helm install haproxy-ingress haproxy-ingress/haproxy-ingress \
--create-namespace --namespace=ingress-controller \
--set controller.hostNetwork=true
kubectl apply -f - <<EOF
apiVersion: networking.k8s.io/v1
kind: IngressClass
metadata:
name: haproxy
annotations:
ingressclass.kubernetes.io/is-default-class: 'true'
spec:
controller: haproxy-ingress.github.io/controller
EOF

echo "Install tekton"
kubectl apply --filename https://storage.googleapis.com/tekton-releases/pipeline/previous/v0.22.0/release.yaml
kubectl apply --filename https://storage.googleapis.com/tekton-releases/triggers/previous/v0.12.1/release.yaml
12 changes: 12 additions & 0 deletions .github/scripts/determine-helm-charts-to-release.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env python

import os, json;

parent_charts_dir=os.environ['CHARTS_DIR']

helm_charts=[]
for file in os.listdir(parent_charts_dir):
if os.path.isdir(os.path.join(parent_charts_dir, file)):
helm_charts.append(file)

print(f"::set-output name=helm-charts::{helm_charts}")
9 changes: 9 additions & 0 deletions .github/scripts/lint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash

# NOTE:
# --validate-chart-schema=false due to https://github.com/helm/chart-testing/pull/300

ct lint \
--chart-dirs ${CHARTS_DIR} \
--all \
--validate-maintainers=false
5 changes: 5 additions & 0 deletions .github/scripts/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash

ct install \
--chart-dirs ${CHARTS_DIR} \
--all
59 changes: 24 additions & 35 deletions .github/workflows/publish-helm-charts-edge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ on:
- .github/**
- charts/**

env:
CHARTS_DIR: 'charts/ploigos-workflow'

jobs:
setup:
runs-on: ubuntu-latest
Expand All @@ -25,9 +28,10 @@ jobs:

- name: Determine Helm Charts to release ⚙️
id: helm-charts
run: |
HELM_CHARTS=$(python -c 'import os, json; print json.dumps(os.listdir("charts/"))')
echo "::set-output name=helm-charts::${HELM_CHARTS}"
run: ${GITHUB_WORKSPACE}/.github/scripts/determine-helm-charts-to-release.py

- name: Helm Charts to Release 📌
run: echo ${{ steps.helm-charts.outputs.helm-charts }}

lint:
runs-on: ubuntu-latest
Expand All @@ -44,24 +48,18 @@ jobs:
- name: Setup Helm 🧰
uses: azure/setup-helm@v1
with:
version: v3.4.1
version: v3.6.1

- name: Setup Python 🧰🐍
uses: actions/setup-python@v2
with:
python-version: 3.7

- name: Setup chart-testing 🧰
uses: helm/chart-testing-action@v2.0.1
uses: helm/chart-testing-action@v2.1.0

# NOTE:
# --validate-chart-schema=false due to https://github.com/helm/chart-testing/pull/300
- name: Lint with chart-testing 🧪🖋
run: |
ct lint \
--all \
--validate-maintainers=false \
--validate-chart-schema=false
run: ${GITHUB_WORKSPACE}/.github/scripts/lint.sh

install-test:
runs-on: ubuntu-latest
Expand All @@ -76,35 +74,24 @@ jobs:
- name: Setup Helm 🧰
uses: azure/setup-helm@v1
with:
version: v3.4.1
version: v3.6.1

- name: Setup Python 🐍
uses: actions/setup-python@v2
with:
python-version: 3.7

- name: Setup chart-testing 🧰
uses: helm/chart-testing-action@v2.0.1
uses: helm/chart-testing-action@v2.1.0

- name: Setup kind cluster 🧰
uses: helm/kind-action@v1.1.0

- name: Configure Kubernetes 🧰
run: |
echo "Install ingress controller"
helm repo add haproxy-ingress https://haproxy-ingress.github.io/charts
helm install haproxy-ingress haproxy-ingress/haproxy-ingress \
--create-namespace --namespace=ingress-controller \
--set controller.hostNetwork=true

echo "Install tekton"
kubectl apply --filename https://storage.googleapis.com/tekton-releases/pipeline/previous/v0.16.3/release.yaml
kubectl apply --filename https://storage.googleapis.com/tekton-releases/triggers/previous/v0.8.1/release.yaml
run: ${GITHUB_WORKSPACE}/.github/scripts/configure-kube.sh

- name: Test install with chart-testing 🧪
run: |
ct install \
--all
run: ${GITHUB_WORKSPACE}/.github/scripts/test.sh

prepare-for-release:
runs-on: ubuntu-latest
Expand All @@ -123,7 +110,7 @@ jobs:
id: helm-chart-info
uses: jacobtomlinson/gha-read-helm-chart@0.1.2
with:
path: charts/${{ matrix.helm-chart }}
path: ${{ env.CHARTS_DIR }}/${{ matrix.helm-chart }}

- name: Set up Python 🐍
uses: actions/setup-python@v2
Expand Down Expand Up @@ -210,12 +197,12 @@ jobs:
uses: docker://mikefarah/yq:3
with:
args:
yq write --inplace charts/${{ matrix.helm-chart }}/Chart.yaml version ${{ steps.helm-chart-next-semver.outputs.next-semver }}
yq write --inplace ${{ env.CHARTS_DIR }}/${{ matrix.helm-chart }}/Chart.yaml version ${{ steps.helm-chart-next-semver.outputs.next-semver }}

# NOTE: workaround for https://github.com/helm/chart-releaser/issues/95
- name: Create Chart.lock ⚙️
run: |
helm dependency update charts/${{ matrix.helm-chart }}
helm dependency update ${{ env.CHARTS_DIR }}/${{ matrix.helm-chart }}

# NOTE:
# Chart.lock uploaded as workaround for https://github.com/helm/chart-releaser/issues/95
Expand All @@ -224,8 +211,8 @@ jobs:
with:
name: ${{ matrix.helm-chart }}
path: |
charts/${{ matrix.helm-chart }}/Chart.yaml
charts/${{ matrix.helm-chart }}/Chart.lock
${{ env.CHARTS_DIR }}/${{ matrix.helm-chart }}/Chart.yaml
${{ env.CHARTS_DIR }}/${{ matrix.helm-chart }}/Chart.lock

release:
runs-on: ubuntu-latest
Expand All @@ -247,7 +234,7 @@ jobs:
id: download-helm-charts
uses: actions/download-artifact@v2
with:
path: charts
path: ${{ env.CHARTS_DIR }}

- name: Push Updated Helm Chart Verions 💾
uses: github-actions-x/commit@v2.7
Expand All @@ -258,9 +245,11 @@ jobs:
- name: Setup Helm 🧰
uses: azure/setup-helm@v1
with:
version: v3.4.1
version: v3.6.1

- name: Run chart-releaser 🚀
uses: helm/chart-releaser-action@v1.1.0
uses: helm/chart-releaser-action@v1.2.1
with:
charts_dir: "${{ env.CHARTS_DIR }}"
env:
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
57 changes: 23 additions & 34 deletions .github/workflows/publish-helm-charts-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ on:
types:
- published

env:
CHARTS_DIR: 'charts/ploigos-workflow'

jobs:
# NOTE:
# * currently no way to filter on release actions
Expand Down Expand Up @@ -42,9 +45,10 @@ jobs:

- name: Determine Helm Charts to release ⚙️
id: helm-charts
run: |
HELM_CHARTS=$(python -c 'import os, json; print json.dumps(os.listdir("charts/"))')
echo "::set-output name=helm-charts::${HELM_CHARTS}"
run: ${GITHUB_WORKSPACE}/.github/scripts/determine-helm-charts-to-release.py

- name: Helm Charts to Release 📌
run: echo ${{ steps.helm-charts.outputs.helm-charts }}

- name: Determine Helm Chart Version ⚙️
id: helm-chart-semver
Expand All @@ -68,24 +72,18 @@ jobs:
- name: Setup Helm 🧰
uses: azure/setup-helm@v1
with:
version: v3.4.1
version: v3.6.1

- name: Setup Python 🧰🐍
uses: actions/setup-python@v2
with:
python-version: 3.7

- name: Setup chart-testing 🧰
uses: helm/chart-testing-action@v2.0.1
uses: helm/chart-testing-action@v2.1.0

# NOTE:
# --validate-chart-schema=false due to https://github.com/helm/chart-testing/pull/300
- name: Lint with chart-testing 🧪🖋
run: |
ct lint \
--all \
--validate-maintainers=false \
--validate-chart-schema=false
run: ${GITHUB_WORKSPACE}/.github/scripts/lint.sh

install-test:
runs-on: ubuntu-latest
Expand All @@ -100,35 +98,24 @@ jobs:
- name: Setup Helm 🧰
uses: azure/setup-helm@v1
with:
version: v3.4.1
version: v3.6.1

- name: Setup Python 🐍
uses: actions/setup-python@v2
with:
python-version: 3.7

- name: Setup chart-testing 🧰
uses: helm/chart-testing-action@v2.0.1
uses: helm/chart-testing-action@v2.1.0

- name: Setup kind cluster 🧰
uses: helm/kind-action@v1.1.0

- name: Configure Kubernetes 🧰
run: |
echo "Install ingress controller"
helm repo add haproxy-ingress https://haproxy-ingress.github.io/charts
helm install haproxy-ingress haproxy-ingress/haproxy-ingress \
--create-namespace --namespace=ingress-controller \
--set controller.hostNetwork=true

echo "Install tekton"
kubectl apply --filename https://storage.googleapis.com/tekton-releases/pipeline/previous/v0.16.3/release.yaml
kubectl apply --filename https://storage.googleapis.com/tekton-releases/triggers/previous/v0.8.1/release.yaml
run: ${GITHUB_WORKSPACE}/.github/scripts/configure-kube.sh

- name: Test install with chart-testing 🧪
run: |
ct install \
--all
run: ${GITHUB_WORKSPACE}/.github/scripts/test.sh

prepare-for-release:
runs-on: ubuntu-latest
Expand All @@ -152,12 +139,12 @@ jobs:
uses: docker://mikefarah/yq:3
with:
args:
yq write --inplace charts/${{ matrix.helm-chart }}/Chart.yaml version ${{ needs.setup.outputs.helm-charts-new-semver }}
yq write --inplace ${{ env.CHARTS_DIR }}/${{ matrix.helm-chart }}/Chart.yaml version ${{ needs.setup.outputs.helm-charts-new-semver }}

# NOTE: workaround for https://github.com/helm/chart-releaser/issues/95
- name: Create Chart.lock ⚙️
run: |
helm dependency update charts/${{ matrix.helm-chart }}
helm dependency update ${{ env.CHARTS_DIR }}/${{ matrix.helm-chart }}

# NOTE:
# Chart.lock uploaded as workaround for https://github.com/helm/chart-releaser/issues/95
Expand All @@ -166,8 +153,8 @@ jobs:
with:
name: ${{ matrix.helm-chart }}
path: |
charts/${{ matrix.helm-chart }}/Chart.yaml
charts/${{ matrix.helm-chart }}/Chart.lock
${{ env.CHARTS_DIR }}/${{ matrix.helm-chart }}/Chart.yaml
${{ env.CHARTS_DIR }}/${{ matrix.helm-chart }}/Chart.lock

release:
runs-on: ubuntu-latest
Expand All @@ -189,7 +176,7 @@ jobs:
id: download-helm-charts
uses: actions/download-artifact@v2
with:
path: charts
path: ${{ env.CHARTS_DIR }}

- name: Push Updated Helm Chart Verions 💾
uses: github-actions-x/commit@v2.7
Expand All @@ -201,10 +188,12 @@ jobs:
- name: Setup Helm 🧰
uses: azure/setup-helm@v1
with:
version: v3.4.1
version: v3.6.1

- name: Run chart-releaser 🚀
uses: helm/chart-releaser-action@v1.1.0
uses: helm/chart-releaser-action@v1.2.1
with:
charts_dir: "${{ env.CHARTS_DIR }}"
env:
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"

Expand Down
Loading