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

Publish Helm Chart in CircleCI #77

Merged
merged 5 commits into from
Oct 17, 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
36 changes: 34 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ commands:
else
echo "export DEPLOY_TAG=$(echo $CIRCLE_TAG)" >> $BASH_ENV
fi

jobs:
lint-test:
machine:
Expand Down Expand Up @@ -95,17 +96,41 @@ jobs:
source $BASH_ENV

ct install --config ct.yaml --helm-extra-set-args "--set=image.tag=$DEPLOY_TAG" --target-branch master
publish_chart:
executor:
name: cci-common/ci_image
flavor: "-google"
parameters:
version:
type: string
steps:
- checkout
- attach_workspace:
at: /tmp
- cci-common/install_gcloud
- cci-common/gcloud_login
- run:
name: "Package and push helm chart"
command: |
source /tmp/secrets || true

export GOOGLE_APPLICATION_CREDENTIALS=/tmp/cluster_secret.json

gcloud auth application-default print-access-token | helm registry login -u oauth2accesstoken --password-stdin https://$K8S_CLUSTER_artifact_registry_url

helm package charts/nightscaler --app-version << parameters.version >> --version << parameters.version >>
helm push nightscaler-<< parameters.version >>.tgz oci://$K8S_CLUSTER_artifact_registry_url/$K8S_CLUSTER_artifact_registry_project/public-docker/chart

workflows:
build:
build-n-publish:
jobs:
- secret-injector/dump-secrets-yaml:
secret-file: secrets-ci.yaml
vault-oidc: true
<<: *prod_context
- cci-common/go_test_unit:
go_version: "1.21.3"
resource_class: large
resource_class: xlarge
requires:
- secret-injector/dump-secrets-yaml
- cci-common/go_test_sonar:
Expand All @@ -129,3 +154,10 @@ workflows:
- cci-common/go_test_unit
- cci-common/go_test_sonar
- cci-common/build_n_push_docker
- publish_chart:
version: $DEPLOY_TAG
pre-steps:
- generate_docker_tag
<<: *prod_context
requires:
- lint-test
43 changes: 0 additions & 43 deletions .github/release-drafter-helm.yml

This file was deleted.

7 changes: 0 additions & 7 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
name-template: "v$RESOLVED_VERSION"
tag-template: "v$RESOLVED_VERSION"
include-labels:
- app
tag-prefix: "v"
categories:
- title: Breaking Changes 💥
Expand Down Expand Up @@ -32,12 +30,7 @@ version-resolver:
labels:
- "patch"
default: patch
autolabeler:
- label: app
files:
- "!chart/**"
template: |

$CHANGES

**Full Changelog**: https://github.com/$OWNER/$REPOSITORY/compare/$PREVIOUS_TAG...v$RESOLVED_VERSION
84 changes: 0 additions & 84 deletions .github/workflows/release-chart.yml

This file was deleted.

35 changes: 0 additions & 35 deletions .github/workflows/release-drafter-helm.yml

This file was deleted.

12 changes: 8 additions & 4 deletions charts/nightscaler/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,19 @@ spec:
env:
- name: NIGHTSCALER_PROJECT_ID
value: {{ .Values.pubsub.projectId }}
- name: NIGHTSCALER_TOPIC
value: {{ .Values.pubsub.topic }}
- name: NIGHTSCALER_CLUSTERNAME
value: {{ .Values.pubsub.clustername }}
- name: NIGHTSCALER_LISTEN_TOPIC
value: {{ .Values.pubsub.listen_topic }}
- name: NIGHTSCALER_PUBLISH_TOPIC
value: {{ .Values.pubsub.publish_topic }}
- name: NIGHTSCALER_TIMEZONE
value: {{ .Values.podEnvVars.timezone }}
- name: NIGHTSCALER_DEBUG
value: "{{ .Values.podEnvVars.debug }}"
- name: NIGHTSCALER_JSON_LOGGING
value: "{{ .Values.podEnvVars.jsonLogging }}"
{{- if .Values.pubsub.clustername }}
- name: NIGHTSCALER_CLUSTERNAME
value: {{ .Values.pubsub.clustername }}
{{- end }}
resources:
{{- toYaml .Values.resources | nindent 12 }}
5 changes: 4 additions & 1 deletion charts/nightscaler/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ pubsub:
projectId: ""
# Pub/Sub topic to subscribe to
# REQUIRED
topic: ""
listen_topic: ""
# Pub/Sub topic to publish to
# REQUIRED
publish_topic: ""
# Name of the cluster it is running in. Used to identify the cluster in the Pub/Sub message.
# REQUIRED
clustername: ""
Expand Down
Loading