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

fix(chart-testing): Fix helm-chart testing workflow #113

Merged
merged 2 commits into from
Jul 10, 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
12 changes: 2 additions & 10 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,16 +49,8 @@ jobs:
if: steps.list-changed.outputs.changed == 'true'
uses: helm/kind-action@v1.7.0

- name: Configure docker credentials
if: steps.list-changed.outputs.changed == 'true'
run: |
kubectl create secret docker-registry iterativeai \
--docker-server=docker.iterative.ai \
--docker-username="${{ secrets.ITERATIVE_DOCKER_REGISTRY_USER }}" \
--docker-password="${{ secrets.ITERATIVE_DOCKER_REGISTRY_PASSWORD }}"

- name: Run chart-testing (install)
if: steps.list-changed.outputs.changed == 'true'
run: |
ct install --namespace default --target-branch ${{ github.event.repository.default_branch }} --upgrade --debug \
--helm-extra-set-args '--set imagePullSecrets[0].name=iterativeai'
ct lint-and-install --target-branch ${{ github.event.repository.default_branch }} --upgrade --debug \
--helm-extra-set-args '--set ci=true --set global.blobvault.persistentVolume.storageClassName="standard" --set imagePullSecrets[0].name=iterativeai --set dockerUsername="${{ secrets.ITERATIVE_DOCKER_REGISTRY_USER }}" --set dockerPassword="${{ secrets.ITERATIVE_DOCKER_REGISTRY_PASSWORD }}" --set dockerServer=docker.iterative.ai'
2 changes: 1 addition & 1 deletion charts/studio/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,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.2.3
version: 0.2.4

# 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
Expand Down
4 changes: 4 additions & 0 deletions charts/studio/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -129,3 +129,7 @@ checksum/secret-studio: {{ include (print $.Template.BasePath "/secret-studio.ya
{{- define "studio.basePath" -}}
{{- printf "%s" .Values.global.basePath | trimPrefix "/" | trimSuffix "/" }}
{{- end }}

{{- define "ciDockerConfig" -}}
{{- printf "{\"auths\": {\"%s\": {\"auth\": \"%s\"}}}" .Values.dockerServer (printf "%s:%s" .Values.dockerUsername .Values.dockerPassword | b64enc) }}
{{- end }}
15 changes: 15 additions & 0 deletions charts/studio/templates/ci-secret-docker-registry.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{{/*
The purpose of this file is to create dockerconfigjson secret o pull images during the chart-testing
tool execution in the CI. This is needed because the chart-testing tool does not support the use of
private registries. This file is only used in the CI, and it is not used in the deployment of the
chart.
*/}}
{{- if (hasKey .Values "ci") }}
apiVersion: v1
data:
.dockerconfigjson: {{ include "dockerconfig" . | b64enc | quote }}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kind: Secret
metadata:
name: iterativeai
type: kubernetes.io/dockerconfigjson
{{- end }}
2 changes: 2 additions & 0 deletions charts/studio/templates/secret-studio.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ apiVersion: v1
kind: Secret
metadata:
name: studio
{{ if (not (hasKey .Values "ci")) }} # Add annotation if we're not in CI execution.
annotations:
"helm.sh/resource-policy": "keep"
{{ end }}
labels:
{{- include "studio.labels" . | nindent 4 }}
type: Opaque
Expand Down