From 7c93d602a7e3e18b175a8d67457f37e9a9be3d73 Mon Sep 17 00:00:00 2001 From: Daniel Mavis <90711593+dmavis@users.noreply.github.com> Date: Wed, 5 Jul 2023 20:11:03 -0500 Subject: [PATCH 1/6] fix: kustomize write target issue (#583) Signed-off-by: Daniel Mavis --- pkg/argocd/git.go | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/pkg/argocd/git.go b/pkg/argocd/git.go index 6aa4b421..8f2ffbcf 100644 --- a/pkg/argocd/git.go +++ b/pkg/argocd/git.go @@ -294,18 +294,8 @@ var _ changeWriter = writeOverrides // writeKustomization writes any changes required for updating one or more images to a kustomization.yml func writeKustomization(app *v1alpha1.Application, wbc *WriteBackConfig, gitC git.Client) (err error, skip bool) { logCtx := log.WithContext().AddField("application", app.GetName()) - if oldDir, err := os.Getwd(); err != nil { - return err, false - } else { - defer func() { - _ = os.Chdir(oldDir) - }() - } base := filepath.Join(gitC.Root(), wbc.KustomizeBase) - if err := os.Chdir(base); err != nil { - return err, false - } logCtx.Infof("updating base %s", base) From f6c4fe387387d342fabcbc06fbe320645163851a Mon Sep 17 00:00:00 2001 From: Daniel Mavis <90711593+dmavis@users.noreply.github.com> Date: Wed, 5 Jul 2023 20:11:44 -0500 Subject: [PATCH 2/6] fix: git zombie processes left behind after periodic image updater runs (#584) Signed-off-by: Daniel Mavis --- Dockerfile | 4 ++-- .../base/deployment/argocd-image-updater-deployment.yaml | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index ec38e462..c374bae7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,7 +14,7 @@ FROM alpine:latest RUN apk update && \ apk upgrade && \ - apk add ca-certificates git openssh-client python3 py3-pip && \ + apk add ca-certificates git openssh-client python3 py3-pip tini && \ pip3 install --upgrade pip && \ pip3 install awscli && \ rm -rf /var/cache/apk/* @@ -28,4 +28,4 @@ COPY hack/git-ask-pass.sh /usr/local/bin/git-ask-pass.sh USER 1000 -ENTRYPOINT ["/usr/local/bin/argocd-image-updater"] +ENTRYPOINT ["/sbin/tini", "--", "/usr/local/bin/argocd-image-updater"] diff --git a/manifests/base/deployment/argocd-image-updater-deployment.yaml b/manifests/base/deployment/argocd-image-updater-deployment.yaml index b5b82607..1e430bf9 100644 --- a/manifests/base/deployment/argocd-image-updater-deployment.yaml +++ b/manifests/base/deployment/argocd-image-updater-deployment.yaml @@ -18,8 +18,7 @@ spec: app.kubernetes.io/name: argocd-image-updater spec: containers: - - command: - - /usr/local/bin/argocd-image-updater + - args: - run image: quay.io/argoprojlabs/argocd-image-updater:latest imagePullPolicy: Always From 568e6b990eba14796f229488337b92b562626f0c Mon Sep 17 00:00:00 2001 From: Abdellah derfoufi Date: Thu, 6 Jul 2023 03:13:36 +0200 Subject: [PATCH 3/6] docs: replace by (#581) Co-authored-by: Abdellah Derfoufi --- docs/configuration/images.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/configuration/images.md b/docs/configuration/images.md index 7edf9bb9..dc492981 100644 --- a/docs/configuration/images.md +++ b/docs/configuration/images.md @@ -126,7 +126,7 @@ You can define the update strategy for each image independently by setting the following annotation to an appropriate value: ```yaml -argocd-image-updater.argoproj.io/.update-strategy: +argocd-image-updater.argoproj.io/.update-strategy: ``` If no update strategy is given, or an invalid value was used, the default @@ -151,7 +151,7 @@ only consider tags that you are generally interested in. You can define a tag filter by using the following annotation: ```yaml -argocd-image-updater.argoproj.io/.allow-tags: +argocd-image-updater.argoproj.io/.allow-tags: ``` The following match functions are currently available: @@ -175,7 +175,7 @@ can define a comma separated list of glob-like patterns using the following annotation: ```yaml -argocd-image-updater.argoproj.io/.ignore-tags: [, , ...] +argocd-image-updater.argoproj.io/.ignore-tags: [, , ...] ``` You can use glob patterns as described in this @@ -187,7 +187,7 @@ preventing the image updater to consider any of the tags returned from the registry: ```yaml -argocd-image-updater.argoproj.io/.ignore-tags: "*" +argocd-image-updater.argoproj.io/.ignore-tags: "*" ``` Please note that regular expressions are not supported to be used for patterns. @@ -231,7 +231,7 @@ container registry (as described [here](../registries/)), or you can specify the pull secret to use for a given image using the annotation ```yaml -argocd-image-updater.argoproj.io/.pull-secret: +argocd-image-updater.argoproj.io/.pull-secret: ``` A configuration for an image will override what is configured for the registry, From 61af5260d10acf8da024959f03f4265458d5cd9c Mon Sep 17 00:00:00 2001 From: satoru Date: Thu, 6 Jul 2023 09:15:06 +0800 Subject: [PATCH 4/6] chore: Fix spell checking config (#577) Signed-off-by: satoru --- .github/actions/spelling/expect.txt | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/actions/spelling/expect.txt b/.github/actions/spelling/expect.txt index b8488f18..b46be5f7 100644 --- a/.github/actions/spelling/expect.txt +++ b/.github/actions/spelling/expect.txt @@ -5,14 +5,12 @@ bacd CVE credref DEBU -DEBU dockerhub eec fbd ffb gitlab jfrog -JFrog mep mypass myregistry @@ -24,7 +22,5 @@ someimage somerepo ssw wildcard -wildcards wohoo yyyy -YYYY From 3d5868d8472995a1635b2f55b6a34bb1ec803910 Mon Sep 17 00:00:00 2001 From: Yuki Nakamura Date: Sun, 9 Jul 2023 04:22:06 +0900 Subject: [PATCH 5/6] docs: Fixed typo (#589) --- docs/basics/authentication.md | 4 ++-- docs/basics/update-methods.md | 4 ++-- docs/basics/update.md | 2 +- docs/install/reference.md | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/basics/authentication.md b/docs/basics/authentication.md index f74b2099..e23c7381 100644 --- a/docs/basics/authentication.md +++ b/docs/basics/authentication.md @@ -1,7 +1,7 @@ # Authentication in Argo CD Image Updater There are several scenarios where Argo CD Image Updater needs to authenticate -to external systems in order to fulfil its duties. +to external systems in order to fulfill its duties. ## Authentication to Kubernetes @@ -207,7 +207,7 @@ echo "someuser:s0mep4ssw0rd" When executing on Kubernetes, the script to be executed must exist in the Image Updater container's file system. You can either mount the script from -a config map, or use an init container to copy it. Make sure that the script +a configmap, or use an init container to copy it. Make sure that the script is executable. For example, if above script would exist at `/usr/local/bin/creds.sh`, it diff --git a/docs/basics/update-methods.md b/docs/basics/update-methods.md index 2a368ea4..1707196c 100644 --- a/docs/basics/update-methods.md +++ b/docs/basics/update-methods.md @@ -3,7 +3,7 @@ ## Overview Argo CD Image Updater supports several methods to propagate new versions of the -images to Argo CD. These methods are also refered to as *write back methods*. +images to Argo CD. These methods are also referred to as *write back methods*. Currently, the following methods are supported: @@ -162,7 +162,7 @@ argocd-image-updater.argoproj.io/git-branch: main ### Specifying a separate base and commit branch -By default, Argo CD Imager Updater will checkout, commit, and push back to the +By default, Argo CD Image Updater will checkout, commit, and push back to the same branch specified above. There are many scenarios where this is not desired or possible, such as when the default branch is protected. You can add a separate write-branch by modifying `argocd-image-updater.argoproj.io/git-branch` diff --git a/docs/basics/update.md b/docs/basics/update.md index 9e23f4a7..623debbb 100644 --- a/docs/basics/update.md +++ b/docs/basics/update.md @@ -18,7 +18,7 @@ The workflow of Argo CD Image Updater can be described as follows: annotation holds a list of image names that should be updated, and is a mandatory annotation for Argo CD Image Updater to indicate it should process this `Application`. Read more about the syntax expected in this - annotations's value in the [marking images for update](#TODO) + annotation's value in the [marking images for update](#TODO) section in this doc. * For each image found in the list, Argo CD Image Updater will first check diff --git a/docs/install/reference.md b/docs/install/reference.md index bfd0b42c..9229ecc5 100644 --- a/docs/install/reference.md +++ b/docs/install/reference.md @@ -123,7 +123,7 @@ Only process applications that have a valid annotation and match the given syntax of `key=value`. For e.g, `custom.label/name=xyz` would be a valid label that can be supplied through this parameter. Any applications carrying this exact label will be considered as candidates for image updates. This parameter -currently does not support patten matching on label values (e.g `customer.label/name=*-staging`) +currently does not support pattern matching on label values (e.g `customer.label/name=*-staging`) and only accepts a single label to match applications against. **--max-concurrency *number* ** From 972500fc657f5980915f07317f963b4b091e4ff7 Mon Sep 17 00:00:00 2001 From: satoru Date: Sun, 9 Jul 2023 05:09:12 +0800 Subject: [PATCH 6/6] chore: Preallocate space for slices with known size (#575) Signed-off-by: satoru --- pkg/registry/endpoints.go | 2 +- pkg/tag/tag.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/registry/endpoints.go b/pkg/registry/endpoints.go index a04ff3b2..3d018112 100644 --- a/pkg/registry/endpoints.go +++ b/pkg/registry/endpoints.go @@ -247,9 +247,9 @@ func SetRegistryEndpointCredentials(prefix, credentials string) error { // ConfiguredEndpoints returns a list of prefixes that are configured func ConfiguredEndpoints() []string { - r := []string{} registryLock.RLock() defer registryLock.RUnlock() + r := make([]string, 0, len(registries)) for _, v := range registries { r = append(r, v.RegistryPrefix) } diff --git a/pkg/tag/tag.go b/pkg/tag/tag.go index 36d083d3..121757e8 100644 --- a/pkg/tag/tag.go +++ b/pkg/tag/tag.go @@ -124,7 +124,7 @@ func (il ImageTagList) Add(tag *ImageTag) { // SortByName returns an array of ImageTag objects, sorted by the tag's name func (il ImageTagList) SortAlphabetically() SortableImageTagList { - sil := SortableImageTagList{} + sil := make(SortableImageTagList, 0, len(il.items)) for _, v := range il.items { sil = append(sil, v) } @@ -136,7 +136,7 @@ func (il ImageTagList) SortAlphabetically() SortableImageTagList { // SortByDate returns a SortableImageTagList, sorted by the tag's date func (il ImageTagList) SortByDate() SortableImageTagList { - sil := SortableImageTagList{} + sil := make(SortableImageTagList, 0, len(il.items)) for _, v := range il.items { sil = append(sil, v) }