-
Notifications
You must be signed in to change notification settings - Fork 598
Open
Description
Expected Behavior
Each workspace mapped with different PVC but when i'm running pipeline got failed with message: '[User error] more than one PersistentVolumeClaim is bound' i have attached pipeline, run, pvc, clone.yaml can you please somebody help me on this.
Environment - EKS cluster 1.29
storage Class: ebs-sc
Actual Behavior
workspace should be mapped with unique PVC.
Additional Info
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS VOLUMEATTRIBUTESCLASS AGE
pack-workspace-vol Bound pvc-ecec8494-cd04-415b-9456-dc6213fe4610 1Gi RWO ebs-sc <unset> 29h
ubi-builder-vol Bound pvc-d0bf27f0-e510-455c-926a-364697c5f227 1Gi RWO ebs-sc <unset> 29h
pipeline.yaml
---
apiVersion: tekton.dev/v1beta1
kind: Pipeline
metadata:
name: pack-build-builder-push
namespace: buildpack-tekton
spec:
description: >-
This Pipeline builds a buildpacks builder image using pack client.
workspaces:
- name: source-dir
- name: data-store
- name: pack-workspace
params:
- description: A boolean value used to execute or not a task
name: debug
type: string
default: "false"
- description: Source Repository URL
name: git-url
type: string
- description: Source directory where code is cloned
name: source-dir
type: string
default: "."
- description: Pack client image url
name: imageUrl
type: string
default: buildpacksio/pack
- description: Pack client image tag
name: imageTag
type: string
default: latest
- description: Name of the Builder image to create
name: output-image
type: string
default: latest
- description: Branch name
name: branch
type: string
- description: Pack builder command flags
name: packCmdBuilderFlags
type: array
default: [""]
tasks:
- name: git-clone
taskRef:
name: git-clone
params:
- name: GIT_PROJECT_URL
value: '$(params.git-url)'
- name: branch
value: '$(params.branch)'
workspaces:
- name: source-dir
workspace: source-dir
- name: fetch-packconfig-registry-secret
runAfter:
- git-clone
taskSpec:
steps:
- image: quay.io/centos/centos:latest
script: |
echo "Copy pack config.toml to $(workspaces.pack-workspace.path)"
cp $(workspaces.data-store.path)/config.toml $(workspaces.pack-workspace.path)
echo "Copy .dockerconfigjson to $(workspaces.pack-workspace.path)/.docker/config.json"
mkdir -p $(workspaces.pack-workspace.path)/.docker
cp $(workspaces.data-store.path)/.dockerconfigjson $(workspaces.pack-workspace.path)/.docker/config.json
workspaces:
- name: data-store
workspace: data-store
- name: pack-workspace
workspace: pack-workspace
- name: list-pack-files
runAfter:
- fetch-packconfig-registry-secret
when:
- input: $(params.debug)
operator: in
values: [ "true" ]
taskSpec:
steps:
- name: list-source-workspace
image: quay.io/centos/centos:latest
script: |
echo "List files under: $(workspaces.pack-workspace.path)"
ls -la $(workspaces.pack-workspace.path)/
ls -la $(workspaces.pack-workspace.path)/.docker/
cat $(workspaces.pack-workspace.path)/.docker/config.json
workspaces:
- name: pack-workspace
workspace: pack-workspace
- name: list-source-files
runAfter:
- fetch-packconfig-registry-secret
when:
- input: $(params.debug)
operator: in
values: [ "true" ]
taskSpec:
steps:
- name: list-source-workspace
image: quay.io/centos/centos:latest
script: |
echo "List files under: $(workspaces.source-dir.path)"
ls -la $(workspaces.source-dir.path)/
workspaces:
- name: source-dir
workspace: source-dir
- name: pack-builder
runAfter:
- list-source-files
taskRef:
name: pack-builder
params:
- name: PACK_SOURCE_DIR
value: '$(params.source-dir)'
- name: PACK_CLI_IMAGE
value: '$(params.imageUrl)'
- name: PACK_CLI_IMAGE_VERSION
value: '$(params.imageTag)'
- name: BUILDER_IMAGE_NAME
value: '$(params.output-image)'
- name: PACK_BUILDER_TOML
value: ubi-builder.toml
- name: PACK_CMD_FLAGS
value: [ "$(params.packCmdBuilderFlags)" ]
workspaces:
- name: source-dir
workspace: source-dir
- name: pack-workspace
workspace: pack-workspace
run.yaml
---
apiVersion: tekton.dev/v1beta1
kind: PipelineRun
metadata:
generateName: pack-build-builder-push-run
namespace: buildpack-tekton
spec:
pipelineRef:
name: pack-build-builder-push
podTemplate:
securityContext:
runAsUser: 0
fsGroup: 1001
params:
- name: debug
value: "true"
- name: git-url
value: github.com/tekton-poc.git
- name: branch
value: main
- name: output-image
value: "quay.io/snowdrop/ubi-builder"
- name: packCmdBuilderFlags
value:
- "-v"
- "--publish"
workspaces:
- name: source-dir
persistentVolumeClaim:
claimName: ubi-builder-vol
- name: pack-workspace
persistentVolumeClaim:
claimName: pack-workspace-vol
- name: data-store
projected:
sources:
- secret:
name: pack-config-toml
- secret:
name: quay-creds
Task-1
---
apiVersion: tekton.dev/v1
kind: Task
metadata:
annotations:
tekton.dev/pipelines.minVersion: "0.50.0"
tekton.dev/categories: Image build
tekton.dev/tags: image-build
tekton.dev/displayName: "pack builder"
tekton.dev/platforms: "linux/amd64"
labels:
app.kubernetes.io/version: '0.1'
name: pack-builder
namespace: buildpack-tekton
spec:
description: >-
params:
- name: PACK_EXPERIMENTAL
default: "false"
description: Enable experimental features
type: string
- name: PACK_CLI_IMAGE
default: buildpacksio/pack
description: The image to use for the pack client.
type: string
- name: PACK_CLI_IMAGE_VERSION
default: latest
description: Pack client version
type: string
- name: BUILDER_IMAGE_NAME
description: The name of the builder image to create.
type: string
- name: PACK_BUILDER_TOML
default: builder.toml
description: The builder toml file to use for the pack builder create command.
type: string
- name: PACK_CMD_FLAGS
default: []
description: The Arguments to be passed to the pack command.
type: array
- name: PACK_SOURCE_DIR
default: .
description: Directory containing the source files to build.
type: string
workspaces:
- name: source-dir
- name: pack-workspace
#mountPath: /workspace
steps:
- name: pack
image: $(params.PACK_CLI_IMAGE):$(params.PACK_CLI_IMAGE_VERSION)
workingDir: $(workspaces.source-dir.path)/$(params.PACK_SOURCE_DIR)
env:
- name: DOCKER_CONFIG
value: $(workspaces.pack-workspace.path)/.docker
- name: PACK_HOME
value: $(workspaces.pack-workspace.path)
args:
- builder
- create
- "$(params.BUILDER_IMAGE_NAME)"
- --config
- "$(params.PACK_BUILDER_TOML)"
- "$(params.PACK_CMD_FLAGS[*])"
clone task
apiVersion: tekton.dev/v1beta1
kind: Task
metadata:
name: git-clone
namespace: buildpack-tekton
spec:
workspaces:
- name: source-dir
description: A workspace for the task
optional: true
mountPath: /mnt/workspace
params:
- name: GIT_PROJECT_URL
type: string
description: The URL of the source repository
- name: branch
type: string
description: Branch name to checkout
steps:
- name: clean-workspace
image: 'alpine:latest'
workingDir: $(workspaces.source-dir.path)
script: |
if [ -d myrepo ]; then
echo "Cleaning previous workspace..."
ls -a myrepo
rm -rf myrepo
echo "Workspace cleaned successfully."
else
echo "No previous workspace found. Proceeding with cloning..."
fi
- name: clone-repository
image: 'quay.io/redhat-cop/ubi8-git:v1.0'
workingDir: $(workspaces.source-dir.path)
script: |
mkdir myrepo
cd myrepo
git clone -b $(params.branch) https://$GITHUB_USERNAME:$GITHUB_PASSWORD@$(params.GIT_PROJECT_URL) .
echo "Repository cloned successfully."
ls -a
---
apiVersion: tekton.dev/v1
kind: Task
metadata:
annotations:
tekton.dev/pipelines.minVersion: 0.50.0
tekton.dev/categories: Image build
tekton.dev/tags: image-build
tekton.dev/displayName: "pack"
tekton.dev/platforms: "linux/amd64"
labels:
app.kubernetes.io/version: '0.1'
name: pack
namespace: buildpack-tekton
spec:
description: >-
Buildpack pack client - https://buildpacks.io/docs/tools/pack/
params:
- name: PACK_EXPERIMENTAL
default: "false"
description: Enable experimental features
type: string
- name: PACK_IMAGE
default: buildpacksio/pack
description: The image to use for the pack client.
type: string
- name: PACK_ARGS
default: []
description: The Arguments to be passed to the pack command.
type: array
- name: PACK_VERSION
default: latest
description: Pack client version
type: string
- name: PACK_SOURCE_DIR
default: .
description: Directory containing the source files to build.
type: string
workspaces:
- name: source-dir
- name: pack-workspace
mountPath: /workspace
steps:
- name: pack
image: $(params.PACK_IMAGE):$(params.PACK_VERSION)
workingDir: $(workspaces.source-dir.path)/$(params.PACK_SOURCE_DIR)
env:
- name: DOCKER_CONFIG
value: $(workspaces.pack-workspace.path)/.docker
- name: PACK_HOME
value: $(workspaces.pack-workspace.path)
args:
- "$(params.PACK_ARGS[*])"
Metadata
Metadata
Assignees
Labels
No labels