From c051e09c9569b3369477c90cec7d3d593fddf898 Mon Sep 17 00:00:00 2001 From: Igor Rzegocki Date: Fri, 27 Sep 2024 15:24:55 +0200 Subject: [PATCH] feat: add argocd --- .github/renovate.json5 | 1 + .github/renovate/customVersions.json5 | 11 +++++++ apps/argocd/Dockerfile | 29 ++++++++++++++++ apps/argocd/metadata.json | 17 ++++++++++ apps/argocd/nullify-subchart-values.patch | 40 +++++++++++++++++++++++ 5 files changed, 98 insertions(+) create mode 100644 .github/renovate/customVersions.json5 create mode 100644 apps/argocd/Dockerfile create mode 100644 apps/argocd/metadata.json create mode 100644 apps/argocd/nullify-subchart-values.patch diff --git a/.github/renovate.json5 b/.github/renovate.json5 index f2629f21..3ae76707 100644 --- a/.github/renovate.json5 +++ b/.github/renovate.json5 @@ -16,6 +16,7 @@ "github>deedee-ops/containers//.github/renovate/autoMerge.json5", "github>deedee-ops/containers//.github/renovate/commitMessage.json5", "github>deedee-ops/containers//.github/renovate/customManagers.json5", + "github>deedee-ops/containers//.github/renovate/customVersions.json5", "github>deedee-ops/containers//.github/renovate/labels.json5", "github>deedee-ops/containers//.github/renovate/semanticCommits.json5" ], diff --git a/.github/renovate/customVersions.json5 b/.github/renovate/customVersions.json5 new file mode 100644 index 00000000..62d55184 --- /dev/null +++ b/.github/renovate/customVersions.json5 @@ -0,0 +1,11 @@ +{ + "$schema": "https://docs.renovatebot.com/renovate-schema.json", + "packageRules": [ + { + "matchPackageNames": ["argocd", "argo-cd", "/argo-?cd/"], + "allowedVersions": "/^[0-9]+\\.[0-9]+\\.[0-9]+(\\.[0-9]+)?$/", + "versioning": "regex:^v?(?\\d+)\\.(?\\d+)\\.(?\\d+)?$" + } + ] +} + diff --git a/apps/argocd/Dockerfile b/apps/argocd/Dockerfile new file mode 100644 index 00000000..beb92e7f --- /dev/null +++ b/apps/argocd/Dockerfile @@ -0,0 +1,29 @@ +ARG TARGETPLATFORM +ARG VERSION + +FROM ghcr.io/deedee-ops/ubuntu:22.04 AS builder + +WORKDIR /usr/src + +#hadolint ignore=DL3008 +RUN apt-get update \ + && apt-get install --yes --no-install-recommends bash build-essential git gnupg2 software-properties-common \ + && add-apt-repository ppa:longsleep/golang-backports -y \ + && apt-get update \ + && apt-get install --yes --no-install-recommends golang-go \ + && git clone --depth 1 --branch release-3.16 https://github.com/helm/helm + +WORKDIR /usr/src/helm + +COPY nullify-subchart-values.patch /usr/src/helm/ + +RUN patch -p1 < nullify-subchart-values.patch \ + && make + +FROM quay.io/argoproj/argocd:v${VERSION} + +COPY --chmod=0755 --chown=0:0 --from=builder /usr/src/helm/bin/helm /usr/local/bin/helm + +ENTRYPOINT ["/usr/bin/tini", "--"] + +LABEL org.opencontainers.image.source="https://github.com/argoproj/argo-cd/" diff --git a/apps/argocd/metadata.json b/apps/argocd/metadata.json new file mode 100644 index 00000000..a294af4e --- /dev/null +++ b/apps/argocd/metadata.json @@ -0,0 +1,17 @@ +{ + "app": "argocd", + "base": false, + "testMuteCmd": true, + "channels": [ + { + "name": "stable", + "renovate::dataSource": "docker", + "renovate::depName": "quay.io/argoproj/argocd", + "version": "2.12.4", + "platforms": [ + "linux/amd64", + "linux/arm64" + ] + } + ] +} diff --git a/apps/argocd/nullify-subchart-values.patch b/apps/argocd/nullify-subchart-values.patch new file mode 100644 index 00000000..388bf36b --- /dev/null +++ b/apps/argocd/nullify-subchart-values.patch @@ -0,0 +1,40 @@ +From 5a58751a053ea59b88399487a5f0f8f5c27b9461 Mon Sep 17 00:00:00 2001 +From: Ryan Hockstad +Date: Wed, 13 Mar 2024 18:17:00 -0400 +Subject: [PATCH] merge null child chart objects + +Signed-off-by: Ryan Hockstad +--- + pkg/chartutil/coalesce.go | 12 ++++++++++++ + 1 file changed, 12 insertions(+) + +diff --git a/pkg/chartutil/coalesce.go b/pkg/chartutil/coalesce.go +index f0272fd6abc..40bce2a68e4 100644 +--- a/pkg/chartutil/coalesce.go ++++ b/pkg/chartutil/coalesce.go +@@ -237,6 +237,9 @@ func coalesceValues(printf printFn, c *chart.Chart, v map[string]interface{}, pr + printf("warning: skipped value for %s.%s: Not a table.", subPrefix, key) + } + } else { ++ // If the key is a child chart, coalesce tables with Merge set to true ++ merge := childChartMergeTrue(c, key, merge) ++ + // Because v has higher precedence than nv, dest values override src + // values. + coalesceTablesFullKey(printf, dest, src, concatPrefix(subPrefix, key), merge) +@@ -249,6 +252,15 @@ func coalesceValues(printf printFn, c *chart.Chart, v map[string]interface{}, pr + } + } + ++func childChartMergeTrue(chrt *chart.Chart, key string, merge bool) bool { ++ for _, subchart := range chrt.Dependencies() { ++ if subchart.Name() == key { ++ return true ++ } ++ } ++ return merge ++} ++ + // CoalesceTables merges a source map into a destination map. + // + // dest is considered authoritative.