fix
This commit is contained in:
@@ -7,7 +7,6 @@ const sources=[
|
||||
#{url: "https://github.com/tektoncd/catalog/raw/main/task/buildpacks-phases/0.2/buildpacks-phases.yaml", name: "buildpacks-phases.yaml"},
|
||||
#{url: "https://github.com/tektoncd/catalog/raw/main/task/buildpacks/0.6/buildpacks.yaml", name: "buildpacks.yaml"},
|
||||
#{url: "https://github.com/tektoncd/catalog/raw/main/task/check-make/0.1/check-make.yaml", name: "check-make.yaml"},
|
||||
#{url: "https://github.com/tektoncd/catalog/raw/main/task/generate-build-id/0.1/generate-build-id.yaml", name: "generate-build-id.yaml"},
|
||||
#{url: "https://github.com/tektoncd/catalog/raw/main/task/gitea-set-status/0.1/gitea-set-status.yaml", name: "gitea-set-status.yaml"},
|
||||
#{url: "https://github.com/tektoncd/catalog/raw/main/task/hadolint/0.1/hadolint.yaml", name: "hadolint.yaml"},
|
||||
#{url: "https://github.com/tektoncd/catalog/raw/main/task/hugo/0.1/hugo.yaml", name: "hugo.yaml"},
|
||||
|
||||
@@ -118,17 +118,17 @@ spec:
|
||||
workspace: source
|
||||
- name: ssh-directory
|
||||
workspace: ssh
|
||||
- name: git-version
|
||||
- name: generate-build-id
|
||||
runAfter: [git-clone]
|
||||
params:
|
||||
- name: branch
|
||||
value: $(params.branch-name)
|
||||
taskRef:
|
||||
name: git-version
|
||||
name: generate-build-id
|
||||
workspaces:
|
||||
- name: source
|
||||
- name: detect-stages
|
||||
runAfter: [git-version]
|
||||
runAfter: [generate-build-id]
|
||||
params:
|
||||
- name: pipeline-type
|
||||
value: push
|
||||
@@ -139,7 +139,7 @@ spec:
|
||||
- name: project-path
|
||||
value: $(params.project-path)
|
||||
- name: image-version
|
||||
value: "$(params.branch-name)-$(tasks.git-version.results.packageVersion)"
|
||||
value: "$(tasks.generate-build-id.results.build-id)"
|
||||
taskRef:
|
||||
name: auto-ci-detector
|
||||
workspaces:
|
||||
|
||||
@@ -16,27 +16,40 @@ spec:
|
||||
the base-version to the current timestamp.
|
||||
|
||||
params:
|
||||
- name: base-version
|
||||
description: Base product version
|
||||
- name: toolbox-image
|
||||
default: sebt3/basic-toolbox-image:1.29.4
|
||||
description: The name of the toolbox image
|
||||
type: string
|
||||
- name: branch
|
||||
type: string
|
||||
default: "1.0"
|
||||
results:
|
||||
- name: timestamp
|
||||
description: Current timestamp
|
||||
- name: commitcount
|
||||
description: Current commitcount
|
||||
- name: build-id
|
||||
description: ID of the current build
|
||||
description: Current commitcount
|
||||
steps:
|
||||
- name: get-timestamp
|
||||
image: docker.io/library/bash:5.0.18@sha256:879f94a9da53dc064779e7a68339aecd60a9028ff884cacaa47ae752ca690404 #tag: 5.0.18
|
||||
image: $(params.toolbox-image)
|
||||
script: |
|
||||
#!/usr/bin/env bash
|
||||
ts=`date "+%Y%m%d-%H%M%S"`
|
||||
echo "Current Timestamp: ${ts}"
|
||||
echo ${ts} | tr -d "\n" | tee $(results.timestamp.path)
|
||||
- name: get-buildid
|
||||
image: docker.io/library/bash:5.0.18@sha256:879f94a9da53dc064779e7a68339aecd60a9028ff884cacaa47ae752ca690404 #tag: 5.0.18
|
||||
echo -n "Current Timestamp: "
|
||||
echo -n ${ts} | tee $(results.timestamp.path)
|
||||
- name: get-commitcount
|
||||
image: $(params.toolbox-image)
|
||||
script: |
|
||||
#!/usr/bin/env bash
|
||||
ts=`cat $(results.timestamp.path)`
|
||||
buildId=$(inputs.params.base-version)-${ts}
|
||||
echo ${buildId} | tr -d "\n" | tee $(results.build-id.path)
|
||||
cc=`git rev-list --count HEAD`
|
||||
echo -n "Commit Count: "
|
||||
echo -n ${cc} | tee $(results.commitcount.path)
|
||||
- name: get-build-id
|
||||
image: $(params.toolbox-image)
|
||||
script: |
|
||||
#!/usr/bin/env bash
|
||||
ts=`cat $(results.timestamp.path)|sed 's/-/./`
|
||||
cc=`cat $(results.commitcount.path)`
|
||||
buildId="$(params.branch)-${cc}.${ts}"
|
||||
echo -n "Build ID: "
|
||||
echo -n ${buildId} | tee $(results.build-id.path)
|
||||
@@ -243,15 +243,6 @@ spec:
|
||||
git remote add origin "${PARAM_URL}"
|
||||
git fetch "--recurse-submodules=${PARAM_SUBMODULES}" $FETCH_CMD origin --update-head-ok --force
|
||||
git reset --hard "${PARAM_REVISION}"
|
||||
#/ko-app/git-init \
|
||||
# -url="${PARAM_URL}" \
|
||||
# -revision="${PARAM_REVISION}" \
|
||||
# -refspec="${PARAM_REFSPEC}" \
|
||||
# -path="${CHECKOUT_DIR}" \
|
||||
# -sslVerify="${PARAM_SSL_VERIFY}" \
|
||||
# -submodules="${PARAM_SUBMODULES}" \
|
||||
# -depth="${PARAM_DEPTH}" \
|
||||
# -sparseCheckoutDirectories="${PARAM_SPARSE_CHECKOUT_DIRECTORIES}"
|
||||
cd "${CHECKOUT_DIR}"
|
||||
RESULT_SHA="$(git rev-parse HEAD)"
|
||||
EXIT_CODE="$?"
|
||||
|
||||
@@ -238,7 +238,7 @@ data:
|
||||
imageRepositoryRef:
|
||||
name: ${PROJECT_NAME}-repo
|
||||
filterTags:
|
||||
pattern: '^v(?P<semver>.*)$'
|
||||
pattern: '^v(?P<semver>(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?)'
|
||||
extract: '$semver'
|
||||
policy:
|
||||
semver:
|
||||
@@ -256,7 +256,7 @@ data:
|
||||
imageRepositoryRef:
|
||||
name: ${PROJECT_NAME}-repo
|
||||
filterTags:
|
||||
pattern: '^main-(?P<semver>.*)$'
|
||||
pattern: '^main-(?P<semver>(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?)'
|
||||
extract: '$semver'
|
||||
policy:
|
||||
semver:
|
||||
|
||||
Reference in New Issue
Block a user