apiVersion: tekton.dev/v1 kind: Task metadata: name: auto-ci-create spec: params: - name: toolbox-image default: sebt3/basic-toolbox-image:1.30.0 description: The name of the toolbox image type: string - name: issuer-name default: letsencrypt-prod type: string - name: domain-name type: string - name: artifactory-url description: The url of the current artifactory - name: project-name description: The git repository name - name: project-path description: The path of the current project - name: git-repository-url description: The git repository url - name: deploy-url description: The git repository url for the deploy project steps: - name: cleanup image: $(params.toolbox-image) workingDir: $(workspaces.source.path) env: - name: ARTIFACTORY_URL value: $(params.artifactory-url) - name: PROJECT_NAME value: $(params.project-name) - name: DOMAIN_NAME value: $(params.domain-name) - name: ISSUER_NAME value: $(params.issuer-name) - name: PROJECT_PATH value: $(params.project-path) - name: GIT_REPOSITORY_URL value: $(params.git-repository-url) - name: DEPLOY_URL value: $(params.deploy-url) script: |- #!/usr/bin/env bash git clone "$(params.deploy-url)" --depth 1 . mkdir -p "projects/$(params.project-name)" bases/project bases/install bases/deploy added=0 copy() { local src=/etc/templates/$1 dest=$2 if [ ! -f $dest ];then cp "$src" "$dest" git add "$dest" added=$(($added+1)) fi } template() { local src=/etc/templates/$1 dest=$2 if [ ! -f $dest ];then envsubst <"$src" >"$dest" git add "$dest" added=$(($added+1)) fi } template base-update.yaml.tmpl bases/project/base-update.yaml copy base-repo.yaml bases/project/repo.yaml copy base-cert.yaml bases/project/cert.yaml copy base-ingress.yaml bases/project/ingress.yaml copy base-policy.yaml bases/project/policy.yaml copy base-deploy.yaml bases/project/deploy.yaml copy base-secret.yaml bases/project/secret.yaml copy base-config.yaml bases/project/config.yaml copy base-service.yaml bases/project/service.yaml copy base-kusto.yaml bases/project/kustomization.yaml copy install-install.yaml bases/install/install.yaml copy install-kusto.yaml bases/install/kustomization.yaml copy deploy-kusto.yaml bases/deploy/kustomization.yaml template deploy-repo.yaml.tmpl bases/deploy/repo.yaml template project-kusto.yaml.tmpl "projects/$(params.project-name)/kustomization.yaml" if [ $added -ne 0 ];then git commit -am "Adding $(params.project-name)" git push fi volumeMounts: - mountPath: /etc/templates name: templates volumes: - name: templates configmap: name: auto-cd-create-templates workspaces: - name: source mountPath: /data - description: | A .ssh directory with private key, known_hosts, config, etc. Copied to the user's home before git commands are executed. Used to authenticate with the git remote when performing the clone. Binding a Secret to this Workspace is strongly recommended over other volume types. name: ssh-directory optional: true