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

chore: helm releasing and testing #26

Merged
merged 9 commits into from
Apr 28, 2023
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
43 changes: 15 additions & 28 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ env:
# Default minimum version of Go to support.
DEFAULT_GO_VERSION: 1.19
REGISTRY: ghcr.io
GITHUB_PAGES_BRANCH: gh_pages

defaults:
run:
shell: bash
Expand Down Expand Up @@ -42,35 +44,20 @@ jobs:
runs-on: ubuntu-latest
if: needs.release-please.outputs.releases_created == 'true'
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Setup go
uses: actions/setup-go@v4
with:
go-version: ${{ env.DEFAULT_GO_VERSION }}

- name: Configure Git
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "$GITHUB_ACTOR@users.noreply.github.com"

- name: Generate helm charts
run: IMG=ghcr.io/k8sgpt-ai/k8sgpt-operator:${{ needs.release-please.outputs.release_tag_name }} make helm-package

- name: Commit files
run: |
git add charts/
git add index.yaml
git commit -s -m "chore: released charts ${{ needs.release-please.outputs.release_tag_name }}"

- name: Push changes
uses: ad-m/github-push-action@master
- uses: actions/checkout@v2
- name: Publish Helm chart
uses: stefanprodan/helm-gh-pages@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ env.GITHUB_PAGES_BRANCH }}
token: ${{ secrets.K8SGPT_BOT_SECRET }}
charts_dir: chart
charts_url: https://charts.k8sgpt.ai
owner: k8sgpt-ai
repository: charts
branch: main
index_dir: ./
target_dir: charts
commit_username: k8sgpt-ai-bot
commit_email: bot@noreply.k8sgpt.ai

build-container:
if: needs.release-please.outputs.releases_created == 'true'
Expand Down
47 changes: 43 additions & 4 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
name: Run tests

on:
push:
branches:
- main
pull_request:
branches:
- main
Expand All @@ -24,4 +21,46 @@ jobs:
go-version: ${{ env.GO_VERSION }}

- name: Test
run: go test -v ./...
run: go test -v ./...

test-chart:
name: Test Helm Chart
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3
with:
fetch-depth: 0
- name: Set up Helm
uses: azure/setup-helm@v3
with:
version: v3.11.2

- uses: actions/setup-python@v4
with:
python-version: '3.9'
check-latest: true

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

- name: Run chart-testing (list-changed)
id: list-changed
run: |
changed=$(ct list-changed --chart-dirs chart --target-branch ${{ github.event.repository.default_branch }})
echo $changed
echo "Hallo"
if [[ -n "$changed" ]]; then
echo "changed=true" >> "$GITHUB_OUTPUT"
fi

- name: Run chart-testing (lint)
if: steps.list-changed.outputs.changed == 'true'
run: ct lint --validate-maintainers=false --chart-dirs chart --target-branch ${{ github.event.repository.default_branch }}

- name: Create kind cluster
if: steps.list-changed.outputs.changed == 'true'
uses: helm/kind-action@v1.4.0

- name: Run chart-testing (install)
if: steps.list-changed.outputs.changed == 'true'
run: ct install --chart-dirs chart --target-branch ${{ github.event.repository.default_branch }}
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -142,10 +142,10 @@ helm-build: helm helmify manifests kustomize
$(KUSTOMIZE) build config/default | $(HELMIFY)

helm-package: generate manifests
$(HELM) package --version $(CHART_VERSION) chart/
$(HELM) package --version $(CHART_VERSION) chart/operator/
mkdir -p charts && mv k8sgpt-operator-*.tgz charts
$(HELM) repo index --url https://charts.k8sgpt.ai/charts charts
mv charts/index.yaml index.yaml
mv charts/operator/index.yaml index.yaml


##@ Build Dependencies
Expand Down
File renamed without changes.
7 changes: 6 additions & 1 deletion chart/Chart.yaml β†’ chart/operator/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
apiVersion: v2
name: k8sgpt-operator
description: A Helm chart for Kubernetes
maintainers:
- name: "The K8sGPT Authors"
email: "noreply@k8sgpt.ai"
url: https://github.com/k8sgpt-ai/community

# A chart can be either an 'application' or a 'library' chart.
#
# Application charts are a collection of templates that can be packaged into versioned archives
Expand All @@ -13,7 +18,7 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.0.6 #x-release-please-version
version: 0.0.6 # x-release-please-version
# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "chart.fullname" . }}-controller-manager-metrics-service
name: {{ include "chart.fullname" . | trunc 20}}-controller-manager-metrics-service
labels:
app.kubernetes.io/component: kube-rbac-proxy
app.kubernetes.io/created-by: k8sgpt-operator
Expand Down
File renamed without changes.