From 2b7341a1f3ef6de4425833534fdaa67d4276f6a7 Mon Sep 17 00:00:00 2001 From: Jann Fischer Date: Thu, 20 Jan 2022 16:33:04 +0100 Subject: [PATCH 1/2] Deprecate version 0.1 of argocd-task-sync-and-wait Since much time has passed since the Argo CD release v1.0.2 and meanwhile the registry for official upstream containers has changed to quay.io, the version 0.1 of this task is being deprecated in favor of its new 0.2 version which will adapt to more reasonable default settings. Signed-off-by: Jann Fischer --- .../argocd-task-sync-and-wait/0.1/argocd-task-sync-and-wait.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/task/argocd-task-sync-and-wait/0.1/argocd-task-sync-and-wait.yaml b/task/argocd-task-sync-and-wait/0.1/argocd-task-sync-and-wait.yaml index e9dd3593a9..93a92bf788 100644 --- a/task/argocd-task-sync-and-wait/0.1/argocd-task-sync-and-wait.yaml +++ b/task/argocd-task-sync-and-wait/0.1/argocd-task-sync-and-wait.yaml @@ -10,6 +10,7 @@ metadata: tekton.dev/tags: deploy tekton.dev/displayName: "argocd" tekton.dev/platforms: "linux/amd64" + tekton.dev/deprecated: "true" spec: description: >- This task syncs (deploys) an Argo CD application and waits for it to be healthy. From 78b15a40a5ef45e196966c6d609ed7f3dd2d301d Mon Sep 17 00:00:00 2001 From: Jann Fischer Date: Thu, 20 Jan 2022 16:35:35 +0100 Subject: [PATCH 2/2] Update task argocd-task-sync-and-wait to v0.2 This changes the container registry where Argo CD image is pulled from docker.io to quay.io (the project deprecated publishing on Docker Hub since a few releases, and will stop publishing new images to there soon). Also bumps the default version used by the task to the latest stable release. Signed-off-by: Jann Fischer --- task/argocd-task-sync-and-wait/0.2/README.md | 77 +++++++++++++++++++ .../0.2/argocd-task-sync-and-wait.yaml | 44 +++++++++++ 2 files changed, 121 insertions(+) create mode 100644 task/argocd-task-sync-and-wait/0.2/README.md create mode 100644 task/argocd-task-sync-and-wait/0.2/argocd-task-sync-and-wait.yaml diff --git a/task/argocd-task-sync-and-wait/0.2/README.md b/task/argocd-task-sync-and-wait/0.2/README.md new file mode 100644 index 0000000000..81678dcc6e --- /dev/null +++ b/task/argocd-task-sync-and-wait/0.2/README.md @@ -0,0 +1,77 @@ +# Argo CD + +This task syncs (deploys) an [Argo CD](https://argoproj.github.io/argo-cd/) application and waits for it to be healthy. To do so, it requires the address of the Argo CD server and some form of authentication - either a username/password or an authentication token. + +## Install the Task + +``` +kubectl apply -f https://raw.githubusercontent.com/tektoncd/catalog/main/task/argocd-task-sync-and-wait/0.2/argocd-task-sync-and-wait.yaml +``` + +## Parameters + +* **application-name:** Name of the application to sync + +* **revision:** The revision to sync to (_default:_ `HEAD`) + +* **flags:** Flags to append after commands, e.g. `--insecure` (_default:_ `--`) + +## Platforms + +The Task can be run on `linux/amd64` platform. + +## Usage + +This `Pipeline` implements the typical CD flow using GitOps, as explained [here](https://argoproj.github.io/argo-cd/user-guide/ci_automation/). It runs a sample `Task` that makes and pushes a change to a Git repository, after which it runs the Argo CD `Task` to sync an application based on that repository. + +The `ConfigMap` and `Secret` give an example of how to define the Argo CD server address and give credentials for logging in. + +```YAML +apiVersion: v1 +kind: ConfigMap +metadata: + name: argocd-env-configmap +data: + ARGOCD_SERVER: +--- +apiVersion: v1 +kind: Secret +metadata: + name: argocd-env-secret +data: + # choose one of username/password or auth token + ARGOCD_USERNAME: + ARGOCD_PASSWORD: + ARGOCD_AUTH_TOKEN: +--- +apiVersion: tekton.dev/v1beta1 +kind: Pipeline +metadata: + name: argocd-pipeline +spec: + tasks: + - name: push-to-git + taskRef: + name: some-git-task # pushes to the Git repository used by the application in the next task + - name: sync-application + taskRef: + name: argocd-task-sync-and-wait + params: + - name: application-name + value: some-application + - name: flags + value: --insecure # needed in this example only because the Argo CD server is locally hosted +``` + +For the `Secret`, choose one of username/password or auth token for logging in. Either of the following are acceptable: + +```YAML +data: + ARGOCD_USERNAME: + ARGOCD_PASSWORD: +``` + +```YAML +data: + ARGOCD_AUTH_TOKEN: +``` diff --git a/task/argocd-task-sync-and-wait/0.2/argocd-task-sync-and-wait.yaml b/task/argocd-task-sync-and-wait/0.2/argocd-task-sync-and-wait.yaml new file mode 100644 index 0000000000..f67de8042e --- /dev/null +++ b/task/argocd-task-sync-and-wait/0.2/argocd-task-sync-and-wait.yaml @@ -0,0 +1,44 @@ +apiVersion: tekton.dev/v1beta1 +kind: Task +metadata: + name: argocd-task-sync-and-wait + labels: + app.kubernetes.io/version: "0.2" + annotations: + tekton.dev/pipelines.minVersion: "0.12.1" + tekton.dev/categories: Deployment + tekton.dev/tags: deploy + tekton.dev/displayName: "argocd" + tekton.dev/platforms: "linux/amd64" +spec: + description: >- + This task syncs (deploys) an Argo CD application and waits for it to be healthy. + + To do so, it requires the address of the Argo CD server and some form of + authentication either a username/password or an authentication token. + + params: + - name: application-name + description: name of the application to sync + - name: revision + description: the revision to sync to + default: HEAD + - name: flags + default: -- + - name: argocd-version + default: v2.2.2 + stepTemplate: + envFrom: + - configMapRef: + name: argocd-env-configmap # used for server address + - secretRef: + name: argocd-env-secret # used for authentication (username/password or auth token) + steps: + - name: login + image: quay.io/argoproj/argocd:$(params.argocd-version) + script: | + if [ -z "$ARGOCD_AUTH_TOKEN" ]; then + yes | argocd login "$ARGOCD_SERVER" --username="$ARGOCD_USERNAME" --password="$ARGOCD_PASSWORD"; + fi + argocd app sync "$(params.application-name)" --revision "$(params.revision)" "$(params.flags)" + argocd app wait "$(params.application-name)" --health "$(params.flags)"