pipeline
pipeline copied to clipboard
Pipeline not creating
Hi everyone. Could please help me. I have pipeline including 3 task (git-clone, kaniko, git-cli). When i try run manifest i get error:
kubectl apply -f build-and-push.yaml
Error from server (BadRequest): error when creating "build-and-push.yaml": admission webhook "webhook.pipeline.tekton.dev" denied the request: mutation failed: cannot create patch for round tripped newBytes: cannot marshal interface: json: error calling MarshalJSON for type v1beta1.ParamValue: impossible ParamValues.Type: ""
tkn version
Client version: 0.28.0
Pipeline version: v0.42.0
Triggers version: v0.22.0
k8s version:
v1.25.4+rke2r1
Hi @Yeroha, thanks for reporting the issue! It would be helpful if you can attach your pipeline yaml here
Hi @XinruZhang
apiVersion: tekton.dev/v1beta1
kind: Pipeline
metadata:
name: pipeline-build-push-image
namespace: tkn-cicd
spec:
description: |
Build and push pipeline
params:
- name: repo-url
type: string
description: The git repository URL to clone from.
- name: branch-name
type: string
description: The git branch to clone.
- name: path-to-dockerfile
type: string
default: ./Dockerfile
description: Path to Dockerfile
- name: path-to-image-context
type: string
default: ./
description: Path to Context
- name: image-url
description: Name (reference) of the image to build.
- name: imageTag
description: Tag to apply to the built image
default: "latest"
- name: base-image
default: alpine/git:latest
workspaces:
- name: git-source
description: |
This workspace will receive the cloned git repo and be passed
to the next Task for the build image.
- name: docker-config
description: |
This workspace using for save config.json
- name: ssh-directory
description: |
This workspace used for change helm values and push to git
tasks:
- name: pipeline-git-source
taskRef:
name: git-clone
workspaces:
- name: output
workspace: git-source
params:
- name: url
value: $(params.repo-url)
- name: revision
value: $(params.branch-name)
- name: build-container-image-and-push
taskRef:
name: kaniko
params:
- name: IMAGE
value: $(params.image-url):$(tasks.pipeline-git-source.results.commit)
- name: CONTEXT
value: $(params.path-to-image-context)
- name: DOCKERFILE
value: $(params.path-to-dockerfile)
runAfter:
- pipeline-git-source
workspaces:
- name: source
workspace: git-source
- name: dockerconfig
workspace: docker-config
- name: git-pull-and-change-helm-and-push
taskRef:
name: git-cli
params:
- name: GIT_SCRIPT
value: |
git clone -b "$(params.branch-name)" "$(params.repo-url)"
cd "$(params.repo-name)"/.infra/"$(params.repo-name)"
sed -i 's/repository:/& "$(params.image-url)" #/' values-"$(params.branch-name)".yaml
sed -i 's/tag:/& "$(tasks.pipeline-git-source.results.commit)" #/' values-"$(params.branch-name)".yaml
git add -A
git commit -m 'Automatic update image tag using tekton. Now service deployed with tag - "$(tasks.pipeline-git-source.results.commit)"'
git push origin "$(params.branch-name)"
runAfter:
- build-container-image-and-push
workspaces:
- name: source
workspace: git-source
- name: repo
workspace: ssh-directory
results:
- name: commit
description: $(tasks.pipeline-git-source.results.commit)
Hi @XinruZhang
apiVersion: tekton.dev/v1beta1 kind: Pipeline metadata: name: pipeline-build-push-image namespace: tkn-cicd spec: description: | Build and push pipeline params: - name: repo-url type: string description: The git repository URL to clone from. - name: branch-name type: string description: The git branch to clone. - name: path-to-dockerfile type: string default: ./Dockerfile description: Path to Dockerfile - name: path-to-image-context type: string default: ./ description: Path to Context - name: image-url description: Name (reference) of the image to build. - name: imageTag description: Tag to apply to the built image default: "latest" - name: base-image default: alpine/git:latest workspaces: - name: git-source description: | This workspace will receive the cloned git repo and be passed to the next Task for the build image. - name: docker-config description: | This workspace using for save config.json - name: ssh-directory description: | This workspace used for change helm values and push to git tasks: - name: pipeline-git-source taskRef: name: git-clone workspaces: - name: output workspace: git-source params: - name: url value: $(params.repo-url) - name: revision value: $(params.branch-name) - name: build-container-image-and-push taskRef: name: kaniko params: - name: IMAGE value: $(params.image-url):$(tasks.pipeline-git-source.results.commit) - name: CONTEXT value: $(params.path-to-image-context) - name: DOCKERFILE value: $(params.path-to-dockerfile) runAfter: - pipeline-git-source workspaces: - name: source workspace: git-source - name: dockerconfig workspace: docker-config - name: git-pull-and-change-helm-and-push taskRef: name: git-cli params: - name: GIT_SCRIPT value: | git clone -b "$(params.branch-name)" "$(params.repo-url)" cd "$(params.repo-name)"/.infra/"$(params.repo-name)" sed -i 's/repository:/& "$(params.image-url)" #/' values-"$(params.branch-name)".yaml sed -i 's/tag:/& "$(tasks.pipeline-git-source.results.commit)" #/' values-"$(params.branch-name)".yaml git add -A git commit -m 'Automatic update image tag using tekton. Now service deployed with tag - "$(tasks.pipeline-git-source.results.commit)"' git push origin "$(params.branch-name)" runAfter: - build-container-image-and-push workspaces: - name: source workspace: git-source - name: repo workspace: ssh-directory results: - name: commit description: $(tasks.pipeline-git-source.results.commit)
hi @Yeroha , you can try to change the results[0].description
to results[0].value
, maybe this will help you
Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale
with a justification.
Stale issues rot after an additional 30d of inactivity and eventually close.
If this issue is safe to close now please do so with /close
with a justification.
If this issue should be exempted, mark the issue as frozen with /lifecycle frozen
with a justification.
/lifecycle stale
Send feedback to tektoncd/plumbing.
Stale issues rot after 30d of inactivity.
Mark the issue as fresh with /remove-lifecycle rotten
with a justification.
Rotten issues close after an additional 30d of inactivity.
If this issue is safe to close now please do so with /close
with a justification.
If this issue should be exempted, mark the issue as frozen with /lifecycle frozen
with a justification.
/lifecycle rotten
Send feedback to tektoncd/plumbing.
Rotten issues close after 30d of inactivity.
Reopen the issue with /reopen
with a justification.
Mark the issue as fresh with /remove-lifecycle rotten
with a justification.
If this issue should be exempted, mark the issue as frozen with /lifecycle frozen
with a justification.
/close
Send feedback to tektoncd/plumbing.
@tekton-robot: Closing this issue.
In response to this:
Rotten issues close after 30d of inactivity. Reopen the issue with
/reopen
with a justification. Mark the issue as fresh with/remove-lifecycle rotten
with a justification. If this issue should be exempted, mark the issue as frozen with/lifecycle frozen
with a justification./close
Send feedback to tektoncd/plumbing.
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.