diff --git a/.harness/charts.yaml b/.harness/charts.yaml new file mode 100644 index 0000000..43083a2 --- /dev/null +++ b/.harness/charts.yaml @@ -0,0 +1,64 @@ +pipeline: + name: devops-charts + identifier: devopscharts + projectIdentifier: Devops + orgIdentifier: default + tags: {} + properties: + ci: + codebase: + connectorRef: account.Indico + repoName: devops-charts + build: <+input> + stages: + - parallel: + - stage: + name: push helm charts + identifier: push_helm_charts + description: "" + type: CI + spec: + cloneCodebase: true + infrastructure: + type: KubernetesDirect + spec: + connectorRef: account.cicdharness + namespace: harness + automountServiceAccountToken: true + nodeSelector: + node_group: cpuxl + os: Linux + execution: + steps: + - step: + type: Run + name: push helm charts + identifier: push_helm_charts + spec: + connectorRef: account.dockerhubproxy + image: alpine/helm:3.16.2 + shell: Sh + command: |- + echo https://dl-cdn.alpinelinux.org/alpine/edge/community >> /etc/apk/repositories + apk update + apk add yq jq bash curl wget parallel + wget -c https://github.com/shteou/helm-dependency-fetch/releases/download/v1.1.3/helm-dependency-fetch_1.1.3_Linux_x86_64.tar.gz -O - | tar -xz + export PATH=${CWD}:${PATH} + helm version + helm plugin install https://github.com/chartmuseum/helm-push --version 0 + helm plugin install https://github.com/nikhilsbhat/helm-images + export DRONE_TAG=<+<+codebase.tag>?<+codebase.tag>:""> + ./upload_helm_charts.sh "<+<+codebase.branch>?<+codebase.branch>:<+codebase.tag>>-<+codebase.commitSha.substring(0,8)>" + envVariables: + PASSWORD: <+secrets.getValue("account.hashicorpvault://vaulttoolsdrone/harbor-push-token#password")> + USERNAME: <+secrets.getValue("account.hashicorpvault://vaulttoolsdrone/harbor-push-token#username")> + PYTHONUNBUFFERED: "1" + DRONE_BRANCH: <+codebase.branch> + HELM_EXPERIMENTAL_OCI: "1" + resources: + limits: + memory: 20G + cpu: "4" + when: + pipelineStatus: Success + allowStageExecutions: true diff --git a/argo-mutator/indico.chart b/argo-mutator/indico.chart new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/argo-mutator/indico.chart @@ -0,0 +1 @@ + diff --git a/argo-mutator/templates/cert.yaml b/argo-mutator/templates/cert.yaml index 1993831..0fdb44f 100644 --- a/argo-mutator/templates/cert.yaml +++ b/argo-mutator/templates/cert.yaml @@ -12,9 +12,9 @@ spec: - {{ include "argo-mutator.fullname" . }}.{{ .Release.Namespace }}.svc commonName: {{ include "argo-mutator.fullname" . }}.{{ .Release.Namespace }}.svc secretName: {{ include "argo-mutator.fullname" . }} - duration: 87600h + duration: 8760h renewBefore: 720h issuerRef: name: selfsigned-issuer kind: ClusterIssuer - group: cert-manager.io \ No newline at end of file + group: cert-manager.io diff --git a/argo-mutator/templates/mutate.yaml b/argo-mutator/templates/mutate.yaml index 013c29f..87b9a28 100644 --- a/argo-mutator/templates/mutate.yaml +++ b/argo-mutator/templates/mutate.yaml @@ -3,7 +3,7 @@ kind: MutatingWebhookConfiguration apiVersion: admissionregistration.k8s.io/v1 metadata: annotations: - cert-manager.io/inject-ca-from: {{ .Release.Namespace }}/{{ .Values.admissionController.certificateName }} + cert-manager.io/inject-ca-from: {{ .Release.Namespace }}/{{ include "argo-mutator.fullname" . }} name: {{ include "argo-mutator.fullname" . }}-mutating-webhook webhooks: - name: {{ .Values.mutate.serviceName }}.{{ .Release.Namespace }}.svc @@ -45,4 +45,4 @@ webhooks: sideEffects: "None" admissionReviewVersions: ["v1"] timeoutSeconds: 5 -{{- end }} \ No newline at end of file +{{- end }} diff --git a/argo-mutator/templates/validate.yaml b/argo-mutator/templates/validate.yaml index 1859a3d..5865cc0 100644 --- a/argo-mutator/templates/validate.yaml +++ b/argo-mutator/templates/validate.yaml @@ -3,7 +3,7 @@ kind: ValidatingWebhookConfiguration apiVersion: admissionregistration.k8s.io/v1 metadata: annotations: - cert-manager.io/inject-ca-from: {{ .Release.Namespace }}/{{ .Values.admissionController.certificateName }} + cert-manager.io/inject-ca-from: {{ .Release.Namespace }}/{{ include "argo-mutator.fullname" . }} name: {{ include "argo-mutator.fullname" . }}-validating-webhook webhooks: - name: {{ .Values.validate.serviceName }}.{{ .Release.Namespace }}.svc diff --git a/argo-mutator/values.yaml b/argo-mutator/values.yaml index cbf3ec2..95f513e 100644 --- a/argo-mutator/values.yaml +++ b/argo-mutator/values.yaml @@ -4,9 +4,6 @@ replicaCount: 2 -admissionController: - certificateName: adm-argo-mutator - image: repository: harbor.devops.indico.io/indico/devops-argo-mutator pullPolicy: Always diff --git a/keycloak-service/Chart.yaml b/devops-keycloak-service/Chart.yaml similarity index 100% rename from keycloak-service/Chart.yaml rename to devops-keycloak-service/Chart.yaml diff --git a/keycloak-service/README.md b/devops-keycloak-service/README.md similarity index 100% rename from keycloak-service/README.md rename to devops-keycloak-service/README.md diff --git a/devops-keycloak-service/indico.chart b/devops-keycloak-service/indico.chart new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/devops-keycloak-service/indico.chart @@ -0,0 +1 @@ + diff --git a/keycloak-service/templates/_helpers.tpl b/devops-keycloak-service/templates/_helpers.tpl similarity index 100% rename from keycloak-service/templates/_helpers.tpl rename to devops-keycloak-service/templates/_helpers.tpl diff --git a/keycloak-service/templates/deployment.yaml b/devops-keycloak-service/templates/deployment.yaml similarity index 100% rename from keycloak-service/templates/deployment.yaml rename to devops-keycloak-service/templates/deployment.yaml diff --git a/keycloak-service/templates/ingress.yaml b/devops-keycloak-service/templates/ingress.yaml similarity index 100% rename from keycloak-service/templates/ingress.yaml rename to devops-keycloak-service/templates/ingress.yaml diff --git a/keycloak-service/templates/secret.yaml b/devops-keycloak-service/templates/secret.yaml similarity index 100% rename from keycloak-service/templates/secret.yaml rename to devops-keycloak-service/templates/secret.yaml diff --git a/keycloak-service/templates/service.yaml b/devops-keycloak-service/templates/service.yaml similarity index 100% rename from keycloak-service/templates/service.yaml rename to devops-keycloak-service/templates/service.yaml diff --git a/keycloak-service/values.yaml b/devops-keycloak-service/values.yaml similarity index 100% rename from keycloak-service/values.yaml rename to devops-keycloak-service/values.yaml diff --git a/required_helm_repos.txt b/required_helm_repos.txt new file mode 100644 index 0000000..c52ca62 --- /dev/null +++ b/required_helm_repos.txt @@ -0,0 +1 @@ + https://prometheus-community.github.io/helm-charts diff --git a/scripts/build_helm_dependencies_new.sh b/scripts/build_helm_dependencies_new.sh new file mode 100755 index 0000000..dd84d9c --- /dev/null +++ b/scripts/build_helm_dependencies_new.sh @@ -0,0 +1,51 @@ +#!/bin/bash +# with the new method we know that all dependent charts are already built +set -euxo pipefail +dir=$1 + +if [ -d "$dir/charts" ]; then + rm -rf $dir/charts + mkdir $dir/charts +else + mkdir $dir/charts +fi + +for local_chart in $(helm dependency list $dir | grep "file://" | awk '{print $2}' | sed -n -e 's/^.*file:\/\/..\///p' ) +do + local_chart_tgz=$(ls .built_local_charts | grep "^$local_chart-v*[0-9]*\.[0-9]*\.[0-9]*\.tgz") + cp ./.built_local_charts/$local_chart_tgz $dir/charts +done + +IFS=$'\n' # make newlines the only separator +for external_chart in $(helm dependency list $dir | grep -E 'https://|oci://' ) +do + chart=$(echo $external_chart | awk '{print $1}') + version=$(echo $external_chart | awk '{print $2}') + source_registry=$(echo $external_chart | awk '{print $3}') + + if [[ $source_registry == oci://* ]]; then + helm pull $source_registry/$chart --version $version --destination $dir/charts + else + registry_name=$(cat .helm_repo_map | grep "$source_registry" | uniq | awk '{print $1}') + + helm pull $registry_name/$chart --version $version --destination $dir/charts + fi +done +unset IFS + +helm package $dir --destination ./.built_local_charts + +mkdir -p .built_oci_charts + +branch=${BRANCH_NAME//\//\-} # replace slashes with - +branch=${branch//_/\-} # replace underscores with - + +chart_version=$(helm show chart $dir | grep '^version:' | awk '{print $2}') + +if [ ! -z "$DRONE_TAG" ]; then + version=$chart_version-${DRONE_TAG} +else + version=$chart_version-$branch +fi + +helm package $dir --version "$version" --destination ./.built_oci_charts diff --git a/scripts/dependency_map_and_build.sh b/scripts/dependency_map_and_build.sh new file mode 100755 index 0000000..fa37150 --- /dev/null +++ b/scripts/dependency_map_and_build.sh @@ -0,0 +1,46 @@ +rm -f .charts +rm -f .charts-tmp +rm -f .tmp + +for fullpath in $(find . -name Chart.yaml | sort) +do + echo $(dirname $fullpath) >> .charts +done + +count=0 + +cp .charts .charts-ext + +while [ -s ".charts" ]; do +cp .charts .charts-tmp +rm -f ".layer${count}" +touch ".layer${count}" +for dir in $(cat .charts) +do + waiting=0 + # check all local dependencies, if they aren't marked completed then this chart can't be either + for dep in $(helm dependency list $dir | grep 'file://' | awk '{print $2}' | sed -n -e 's/^.*file:\/\/..\///p') + do + if [ $(grep -Rx "./$dep" .charts) ]; then + waiting=1 + fi + done + if [ $waiting = "0" ]; then + echo $dir >> ".layer${count}" + cat .charts-tmp | grep -vx $dir > .tmp + mv .tmp .charts-tmp + fi +done +count=$((count + 1)) +mv .charts-tmp .charts +done + +echo "Done building dependency map" + +for layerfile in $(ls -lart | grep .layer | awk '{print $9}' | sort) +do + cat $layerfile | parallel --halt-on-error 1 -k --joblog .dependent-results-${i} -j 16 ./scripts/build_helm_dependencies_new.sh + cat .dependent-results-${i} +done + + diff --git a/scripts/push_helm_chart.sh b/scripts/push_helm_chart.sh new file mode 100755 index 0000000..3ad3403 --- /dev/null +++ b/scripts/push_helm_chart.sh @@ -0,0 +1,83 @@ +#!/bin/bash + +set -e +fullpath=${1#"./"} +BRANCH_NAME=$2 # e.g: "main-xxxxxx" + +dir=$(dirname $fullpath) +name=$(helm show chart $dir | yq '.name') +version=$(helm show chart $dir | yq '.version') +chart_version=$version + +echo " " +echo "-------------------------------------------------------------------------------------------" + +branch=${BRANCH_NAME//\//\-} # replace slashes with - +branch=${branch//_/\-} # replace underscores with - + +if [ ! -z "$DRONE_TAG" ]; then + version=$version-${DRONE_TAG} +else + version=$version-$branch +fi + +num_charts=$((num_charts+1)) + +echo "Working on Chart $name, Version: $version" + +if [ -d "$dir/tests" ] +then + for testfile in $(find $dir/tests -name '*.yaml') + do + testname=$(basename "$testfile") + echo "Running test with $testfile" + + echo helm template ./$dir --dependency-update --name-template $testname --namespace default --kube-version 1.27 --values $testfile --include-crds --debug > /dev/null + helm template ./$dir --dependency-update --name-template $testname --namespace default --kube-version 1.27 --values $testfile --include-crds --debug > /dev/null + + + echo "Linting chart" + helm lint ./$dir --values $testfile + + echo "Images referenced" + helm template ./$dir --dependency-update --name-template $testname --namespace default --kube-version 1.27 --values $testfile --include-crds | yq '..|.image? | select(.)' | sort -u + done +fi + +#Push chart, check if it succeeded, if not, retry. +oci_chart_tgz=$(ls .built_oci_charts | grep "^$dir-v*[0-9]*\.[0-9]*\.[0-9]*-.*.tgz") +pushed="false" +retry_attempts=10 +until [ $pushed == "true" ] || [ $retry_attempts -le 0 ] +do + if [ $retry_attempts -ne 10 ]; then + echo "Retry push ${dir} [$retry_attempts]" + sleep 10 + fi + + set +e + echo "helm push .built_oci_charts/$oci_chart_tgz oci://harbor.devops.indico.io/indico-charts [$retry_attempts]" + if helm push .built_oci_charts/$oci_chart_tgz oci://harbor.devops.indico.io/indico-charts; then + echo "\t--> oci://harbor.devops.indico.io/indico-charts/${name}:${version}\n" >> .pushed + pushed="true" + else + pushed="false" + fi + set -e + ((retry_attempts--)) +done + +echo "done" +set -e +# double-check that the chart was pushed. +if [ $retry_attempts -le 0 ]; then + echo "Error: Unable to push oci://harbor.devops.indico.io/indico-charts/${name}:${version}" + exit 1 +fi + + + + + + + diff --git a/thanos-terraform/backend.tf b/thanos-terraform/backend.tf deleted file mode 100644 index 7fdd0ee..0000000 --- a/thanos-terraform/backend.tf +++ /dev/null @@ -1,8 +0,0 @@ -terraform { - cloud { - organization = "indico" - workspaces { - name = "thanos-monitoring-setup" - } - } -} diff --git a/thanos-terraform/helm-charts/thanos-pre-reqs/.helmignore b/thanos-terraform/helm-charts/thanos-pre-reqs/.helmignore deleted file mode 100644 index 0e8a0eb..0000000 --- a/thanos-terraform/helm-charts/thanos-pre-reqs/.helmignore +++ /dev/null @@ -1,23 +0,0 @@ -# Patterns to ignore when building packages. -# This supports shell glob matching, relative path matching, and -# negation (prefixed with !). Only one pattern per line. -.DS_Store -# Common VCS dirs -.git/ -.gitignore -.bzr/ -.bzrignore -.hg/ -.hgignore -.svn/ -# Common backup files -*.swp -*.bak -*.tmp -*.orig -*~ -# Various IDEs -.project -.idea/ -*.tmproj -.vscode/ diff --git a/thanos-terraform/helm-charts/thanos-pre-reqs/Chart.yaml b/thanos-terraform/helm-charts/thanos-pre-reqs/Chart.yaml deleted file mode 100644 index 15b7056..0000000 --- a/thanos-terraform/helm-charts/thanos-pre-reqs/Chart.yaml +++ /dev/null @@ -1,37 +0,0 @@ -apiVersion: v2 -name: thanos-pre-reqs -description: Indico thanos stack pre-requisites - -# 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 -# to be deployed. -# -# Library charts provide useful utilities or functions for the chart developer. They're included as -# a dependency of application charts to inject those utilities and functions into the rendering -# pipeline. Library charts do not define any templates and therefore cannot be deployed. -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.1.0 - -# 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. -# It is recommended to use it with quotes. -appVersion: "1.0.0" - -# helm upgrade -i grafana-operator oci://ghcr.io/grafana-operator/helm-charts/grafana-operator --version v5.4.2\n -dependencies: - - name: grafana-operator - version: v5.4.2 - repository: oci://ghcr.io/grafana-operator/helm-charts - condition: grafana-operator.enabled - - - name: vault-secrets-operator - repository: https://helm.releases.hashicorp.com - version: 0.4.0 - condition: vault-secrets-operator.enabled - diff --git a/thanos-terraform/helm-charts/thanos-pre-reqs/templates/_helpers.tpl b/thanos-terraform/helm-charts/thanos-pre-reqs/templates/_helpers.tpl deleted file mode 100644 index 3677392..0000000 --- a/thanos-terraform/helm-charts/thanos-pre-reqs/templates/_helpers.tpl +++ /dev/null @@ -1,62 +0,0 @@ -{{/* -Expand the name of the chart. -*/}} -{{- define "thanos-pre-reqs.name" -}} -{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} -{{- end }} - -{{/* -Create a default fully qualified app name. -We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). -If release name contains chart name it will be used as a full name. -*/}} -{{- define "thanos-pre-reqs.fullname" -}} -{{- if .Values.fullnameOverride }} -{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} -{{- else }} -{{- $name := default .Chart.Name .Values.nameOverride }} -{{- if contains $name .Release.Name }} -{{- .Release.Name | trunc 63 | trimSuffix "-" }} -{{- else }} -{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} -{{- end }} -{{- end }} -{{- end }} - -{{/* -Create chart name and version as used by the chart label. -*/}} -{{- define "thanos-pre-reqs.chart" -}} -{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} -{{- end }} - -{{/* -Common labels -*/}} -{{- define "thanos-pre-reqs.labels" -}} -helm.sh/chart: {{ include "thanos-pre-reqs.chart" . }} -{{ include "thanos-pre-reqs.selectorLabels" . }} -{{- if .Chart.AppVersion }} -app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} -{{- end }} -app.kubernetes.io/managed-by: {{ .Release.Service }} -{{- end }} - -{{/* -Selector labels -*/}} -{{- define "thanos-pre-reqs.selectorLabels" -}} -app.kubernetes.io/name: {{ include "thanos-pre-reqs.name" . }} -app.kubernetes.io/instance: {{ .Release.Name }} -{{- end }} - -{{/* -Create the name of the service account to use -*/}} -{{- define "thanos-pre-reqs.serviceAccountName" -}} -{{- if .Values.serviceAccount.create }} -{{- default (include "thanos-pre-reqs.fullname" .) .Values.serviceAccount.name }} -{{- else }} -{{- default "default" .Values.serviceAccount.name }} -{{- end }} -{{- end }} diff --git a/thanos-terraform/helm-charts/thanos-pre-reqs/values.yaml b/thanos-terraform/helm-charts/thanos-pre-reqs/values.yaml deleted file mode 100644 index d39cdca..0000000 --- a/thanos-terraform/helm-charts/thanos-pre-reqs/values.yaml +++ /dev/null @@ -1,5 +0,0 @@ -grafana-operator: - enabled: true - -vault-secrets-operator: - enabled: true diff --git a/thanos-terraform/helm-charts/thanos/.helmignore b/thanos-terraform/helm-charts/thanos/.helmignore deleted file mode 100644 index 0e8a0eb..0000000 --- a/thanos-terraform/helm-charts/thanos/.helmignore +++ /dev/null @@ -1,23 +0,0 @@ -# Patterns to ignore when building packages. -# This supports shell glob matching, relative path matching, and -# negation (prefixed with !). Only one pattern per line. -.DS_Store -# Common VCS dirs -.git/ -.gitignore -.bzr/ -.bzrignore -.hg/ -.hgignore -.svn/ -# Common backup files -*.swp -*.bak -*.tmp -*.orig -*~ -# Various IDEs -.project -.idea/ -*.tmproj -.vscode/ diff --git a/thanos-terraform/helm-charts/thanos/Chart.yaml b/thanos-terraform/helm-charts/thanos/Chart.yaml deleted file mode 100644 index a6233de..0000000 --- a/thanos-terraform/helm-charts/thanos/Chart.yaml +++ /dev/null @@ -1,46 +0,0 @@ -apiVersion: v2 -name: thanos -description: A Helm chart for installing Indico's Thanos Stack - -# 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 -# to be deployed. -# -# Library charts provide useful utilities or functions for the chart developer. They're included as -# a dependency of application charts to inject those utilities and functions into the rendering -# pipeline. Library charts do not define any templates and therefore cannot be deployed. -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.1.1 - -# 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. -# It is recommended to use it with quotes. -appVersion: "1.0.1" - -dependencies: - - name: kube-prometheus-stack - repository: https://prometheus-community.github.io/helm-charts - version: 54.2.2 - condition: kube-prometheus-stack.enabled - - - name: thanos - repository: https://charts.bitnami.com/bitnami - version: 12.16.1 - condition: thanos.enabled - - - name: grafana - version: 7.0.9 - repository: https://grafana.github.io/helm-charts - condition: grafana.enabled - - - name: ingress-nginx - repository: https://kubernetes.github.io/ingress-nginx - version: 4.7.2 - condition: ingress-nginx.enabled - diff --git a/thanos-terraform/helm-charts/thanos/templates/grafanas.yaml b/thanos-terraform/helm-charts/thanos/templates/grafanas.yaml deleted file mode 100644 index ea0dd24..0000000 --- a/thanos-terraform/helm-charts/thanos/templates/grafanas.yaml +++ /dev/null @@ -1,17 +0,0 @@ -apiVersion: grafana.integreatly.org/v1beta1 -kind: Grafana -metadata: - labels: - dashboards: external-grafana - name: external-grafana - namespace: default -spec: - external: - adminPassword: - key: admin-password - name: t-grafana - adminUser: - key: admin-user - name: t-grafana - url: https://grafana.monitoring.us-east-2.indico-devops.indico.io - \ No newline at end of file diff --git a/thanos-terraform/helm-charts/thanos/templates/secrets.yaml b/thanos-terraform/helm-charts/thanos/templates/secrets.yaml deleted file mode 100644 index c1c5f88..0000000 --- a/thanos-terraform/helm-charts/thanos/templates/secrets.yaml +++ /dev/null @@ -1,22 +0,0 @@ ---- -apiVersion: "secrets.hashicorp.com/v1beta1" -kind: "VaultStaticSecret" -metadata: - name: vault-thanos-storage - namespace: default -spec: - type: "kv-v2" - namespace: default - mount: customer-Indico-Devops - path: thanos-storage - refreshAfter: 60s - rolloutRestartTargets: - - name: p-monitoring-kube-prometheus-prometheus - kind: StatefulSet - destination: - annotations: - reflector.v1.k8s.emberstack.com/reflection-allowed: "true" - reflector.v1.k8s.emberstack.com/reflection-auto-enabled: "true" - create: true - name: thanos-storage - vaultAuthRef: default diff --git a/thanos-terraform/helm-charts/thanos/values.yaml b/thanos-terraform/helm-charts/thanos/values.yaml deleted file mode 100644 index 0fe50dd..0000000 --- a/thanos-terraform/helm-charts/thanos/values.yaml +++ /dev/null @@ -1,26 +0,0 @@ - -kube-prometheus-stack: - enabled: true - - prometheus: - enabled: false - - grafana: - enabled: false - -grafana: - enabled: true - -thanos: - enabled: true - -ingress-nginx: - enabled: true - controller: - replicaCount: 3 - rbac: - create: true - - - - \ No newline at end of file diff --git a/thanos-terraform/install-charts.tf b/thanos-terraform/install-charts.tf deleted file mode 100644 index 6a8154a..0000000 --- a/thanos-terraform/install-charts.tf +++ /dev/null @@ -1,167 +0,0 @@ -resource "helm_release" "thanos-pre-reqs" { - name = "tpr" - chart = "thanos-pre-reqs" - repository = "./helm-charts" - dependency_update = true - values = [ - < /dev/null + echo "$reponame-$repo_index $url" >> .helm_repo_map +done + +echo "harborprod https://harbor.devops.indico.io/chartrepo/indico-charts" >> .helm_repo_map +helm registry login --username $USERNAME --password $PASSWORD https://harbor.devops.indico.io/indico-charts + +if [ -d ".built_local_charts" ]; then + rm -rf .built_local_charts + mkdir .built_local_charts +else + mkdir .built_local_charts +fi + +export BRANCH_NAME=$1 + +# Build and package all helm charts +sh scripts/dependency_map_and_build.sh + + +# Push the packaged helm charts +if [ -f ".indico-charts" ]; then + rm .indico-charts +fi + +# only push charts that have the marker indico.chart and a Chart.yaml file in it. +for fullpath in $(find . -name indico.chart | sort) +do + dirname=$(dirname $fullpath) + if [ -f "$dirname/Chart.yaml" ]; then + echo "$dirname/Chart.yaml" >> .indico-charts + fi +done + +if [ -f ".pushed" ]; then + rm .pushed +else + touch .pushed +fi + +jobs_parallel_pushed=1 +echo "Pushing Charts $jobs_parallel_pushed way" +cat .indico-charts | parallel --halt-on-error 1 -k --joblog .push-results -j $jobs_parallel_pushed ./scripts/push_helm_chart.sh {} "$1" +echo "Finished Chart Uploads" +cat .push-results + +cat .pushed