initial commit
This commit is contained in:
18
dev/tekton/tasks/argocd-sync-and-wait/app-project.yaml
Normal file
18
dev/tekton/tasks/argocd-sync-and-wait/app-project.yaml
Normal file
@@ -0,0 +1,18 @@
|
||||
apiVersion: argoproj.io/v1alpha1
|
||||
kind: AppProject
|
||||
metadata:
|
||||
name: default
|
||||
namespace: argocd
|
||||
spec:
|
||||
description: Default project
|
||||
destinations:
|
||||
- namespace: '*'
|
||||
server: https://kubernetes.default.svc
|
||||
sourceRepos:
|
||||
- '*'
|
||||
clusterResourceWhitelist:
|
||||
- group: '*'
|
||||
kind: '*'
|
||||
namespaceResourceBlacklist:
|
||||
- group: backstage.io
|
||||
kind: Component
|
||||
@@ -0,0 +1,7 @@
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: argocd-env-configmap
|
||||
namespace: default
|
||||
data:
|
||||
ARGOCD_SERVER: argocd-dev.allarddcs.nl
|
||||
10
dev/tekton/tasks/argocd-sync-and-wait/argocd-pipeline-run.yaml
Executable file
10
dev/tekton/tasks/argocd-sync-and-wait/argocd-pipeline-run.yaml
Executable file
@@ -0,0 +1,10 @@
|
||||
apiVersion: tekton.dev/v1beta1
|
||||
kind: PipelineRun
|
||||
metadata:
|
||||
generateName: argocd-pipeline-run-
|
||||
spec:
|
||||
pipelineRef:
|
||||
name: argocd-pipeline-test
|
||||
params:
|
||||
- name: sonar-project-key
|
||||
value: olproperties
|
||||
19
dev/tekton/tasks/argocd-sync-and-wait/argocd-pipeline.yaml
Executable file
19
dev/tekton/tasks/argocd-sync-and-wait/argocd-pipeline.yaml
Executable file
@@ -0,0 +1,19 @@
|
||||
apiVersion: tekton.dev/v1beta1
|
||||
kind: Pipeline
|
||||
metadata:
|
||||
name: argocd-pipeline-test
|
||||
spec:
|
||||
description: |
|
||||
This pipeline tests argocd
|
||||
params:
|
||||
- name: sonar-project-key
|
||||
type: string
|
||||
|
||||
tasks:
|
||||
|
||||
- name: deploy-with-argocd
|
||||
taskref:
|
||||
name: argocd-task-sync-and-wait
|
||||
params:
|
||||
- name: application-name
|
||||
value: $(params.sonar-project-key)
|
||||
@@ -0,0 +1,43 @@
|
||||
apiVersion: tekton.dev/v1
|
||||
kind: Task
|
||||
metadata:
|
||||
name: argocd-task-sync-and-wait
|
||||
namespace: default
|
||||
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:
|
||||
- description: name of the application to sync
|
||||
name: application-name
|
||||
type: string
|
||||
- default: HEAD
|
||||
description: the revision to sync to
|
||||
name: revision
|
||||
type: string
|
||||
- default: --
|
||||
name: flags
|
||||
type: string
|
||||
- default: v2.2.2
|
||||
name: argocd-version
|
||||
type: string
|
||||
stepTemplate:
|
||||
computeResources: {}
|
||||
envFrom:
|
||||
- configMapRef:
|
||||
name: argocd-env-configmap
|
||||
- secretRef:
|
||||
name: argocd-env-secret
|
||||
steps:
|
||||
- computeResources: {}
|
||||
image: argoproj/argocd
|
||||
name: login
|
||||
script: |
|
||||
echo "ARGOCD_SERVER = " $ARGOCD_SERVER
|
||||
echo "ARGOCD_USERNAME = " $ARGOCD_USERNAME
|
||||
echo "ARGOCD_PASSWORD = " $ARGOCD_PASSWORD
|
||||
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)"
|
||||
3
dev/tekton/tasks/argocd-sync-and-wait/create-argocd-env-secret.sh
Executable file
3
dev/tekton/tasks/argocd-sync-and-wait/create-argocd-env-secret.sh
Executable file
@@ -0,0 +1,3 @@
|
||||
microk8s kubectl create secret generic argocd-env-secret \
|
||||
--from-literal=ARGOCD_USERNAME=admin \
|
||||
--from-literal=ARGOCD_PASSWORD='Argocd01@'
|
||||
18
dev/tekton/tasks/argocd-sync-and-wait/default-project.yaml
Normal file
18
dev/tekton/tasks/argocd-sync-and-wait/default-project.yaml
Normal file
@@ -0,0 +1,18 @@
|
||||
apiVersion: argoproj.io/v1alpha1
|
||||
kind: AppProject
|
||||
metadata:
|
||||
name: default
|
||||
namespace: argocd
|
||||
spec:
|
||||
description: Default project
|
||||
destinations:
|
||||
- namespace: '*' # Allow all namespaces
|
||||
server: https://kubernetes.default.svc
|
||||
sourceRepos:
|
||||
- '*' # Allow all repositories
|
||||
clusterResourceWhitelist:
|
||||
- group: '*' # Allow all cluster-scoped resources
|
||||
kind: '*'
|
||||
namespaceResourceBlacklist:
|
||||
- group: backstage.io # Exclude all Backstage API group
|
||||
kind: Component # Exclude Component kind
|
||||
Reference in New Issue
Block a user