diff --git a/ci/pipelines/builder.yml b/ci/pipelines/builder.yml index 49e624410f..9e4e6e69de 100644 --- a/ci/pipelines/builder.yml +++ b/ci/pipelines/builder.yml @@ -1,4 +1,10 @@ +anchors: + ci_bot: + email: &ci_bot_email bots@cloudfoundry.org + name: &ci_bot_name CI Bot + #@ load("@ytt:data", "data") + #@yaml/text-templated-strings groups: @@ -256,9 +262,9 @@ jobs: - usn-log/usn-log.json rename: (@= data.values.stemcell_details.branch @)/(@= data.values.stemcell_details.os_name @).meta4 options: - author_email: ci@localhost - author_name: CI Bot - message: '[ci skip] bump OS image' + author_email: *ci_bot_email + author_name: *ci_bot_name + message: 'Bump os-image tgz' version: version/version - put: os-image-version params: @@ -493,8 +499,8 @@ jobs: - stemcell/*.tgz rename: "{{.Version}}/(@= IAAS @)-(@= HYPERVISOR @)(@= FIPS @).meta4" options: - author_email: ci@localhost - author_name: CI Bot + author_email: *ci_bot_email + author_name: *ci_bot_name message: 'dev: (@= data.values.stemcell_details.os_name @)' version: candidate-build-number/number #@ end @@ -627,7 +633,10 @@ jobs: - task: commit-build-time file: bosh-stemcells-ci/ci/tasks/commit-build-time.yml image: os-image-stemcell-builder-registry-image - #@ if len(data.values.stemcell_details.include_fips_iaas) > 0: + params: + GIT_USER_EMAIL: *ci_bot_email + GIT_USER_NAME: *ci_bot_name + #@ if len(data.values.stemcell_details.include_fips_iaas) > 0: - task: copy-fips-artifacts file: bosh-stemcells-ci/ci/tasks/publish.yml image: bosh-integration-image @@ -647,7 +656,9 @@ jobs: TO_INDEX: candidate AWS_ENDPOINT: "https://storage.googleapis.com" S3_API_ENDPOINT: storage.googleapis.com - #@ end + GIT_USER_EMAIL: *ci_bot_email + GIT_USER_NAME: *ci_bot_name + #@ end - task: copy-artifacts file: bosh-stemcells-ci/ci/tasks/publish.yml image: bosh-integration-image @@ -667,6 +678,8 @@ jobs: TO_INDEX: candidate AWS_ENDPOINT: "https://storage.googleapis.com" S3_API_ENDPOINT: storage.googleapis.com + GIT_USER_EMAIL: *ci_bot_email + GIT_USER_NAME: *ci_bot_name - in_parallel: - put: bosh-linux-stemcell-builder-push-tags no_get: true @@ -753,8 +766,8 @@ jobs: output_mapping: output-repo: bosh-linux-stemcell-builder params: - GIT_USER_NAME: CI Bot - GIT_USER_EMAIL: bots@cloudfoundry.org + GIT_USER_EMAIL: *ci_bot_email + GIT_USER_NAME: *ci_bot_name PACKAGE: ruby-((.:ruby_version)) VENDOR: true - task: test-unit @@ -817,6 +830,9 @@ jobs: - task: bump file: bosh-stemcells-ci/ci/tasks/bump-bosh-agent.yml image: bosh-integration-image + params: + GIT_USER_EMAIL: *ci_bot_email + GIT_USER_NAME: *ci_bot_name - put: bosh-linux-stemcell-builder-push params: rebase: true @@ -837,6 +853,8 @@ jobs: image: bosh-integration-image params: BLOBSTORE_TYPE: (@= blobstore_type @) + GIT_USER_EMAIL: *ci_bot_email + GIT_USER_NAME: *ci_bot_name - put: bosh-linux-stemcell-builder-push params: rebase: true diff --git a/ci/pipelines/publisher.yml b/ci/pipelines/publisher.yml index e51f554a1d..b285d63335 100644 --- a/ci/pipelines/publisher.yml +++ b/ci/pipelines/publisher.yml @@ -230,6 +230,11 @@ ensure: #@yaml/text-templated-strings --- +anchors: + ci_bot: + email: &ci_bot_email bots@cloudfoundry.org + name: &ci_bot_name CI Bot + groups: - name: all jobs: @@ -379,8 +384,8 @@ jobs: files: - light-stemcell/*.tgz options: - author_email: ci@localhost - author_name: CI Bot + author_email: *ci_bot_email + author_name: *ci_bot_name message: 'candidate (light aws): (@= data.values.stemcell_details.os_name @)/(@= str(data.values.stemcell_details.major_version) @).x' version: us-input-stemcell/.resource/version put: candidate-aws-light-(@= data.values.stemcell_details.os_name @)-stemcell-(@= str(data.values.stemcell_details.major_version) @) @@ -416,8 +421,8 @@ jobs: files: - light-stemcell/*.tgz options: - author_email: ci@localhost - author_name: CI Bot + author_email: *ci_bot_email + author_name: *ci_bot_name message: 'candidate (light google): (@= data.values.stemcell_details.os_name @)/(@= str(data.values.stemcell_details.major_version) @).x' version: stemcell/.resource/version put: candidate-google-light-(@= data.values.stemcell_details.os_name @)-stemcell-(@= str(data.values.stemcell_details.major_version) @) @@ -487,8 +492,8 @@ jobs: files: - candidate-(@= data.values.stemcell_details.os_name @)-stemcell-(@= str(data.values.stemcell_details.major_version) @)/*.tgz options: - author_email: ci@localhost - author_name: CI Bot + author_email: *ci_bot_email + author_name: *ci_bot_name message: 'publish (heavy): (@= data.values.stemcell_details.os_name @)/(@= str(data.values.stemcell_details.major_version) @).x' rename: '{{.Version}}/stemcells.meta4' version: candidate-(@= data.values.stemcell_details.os_name @)-stemcell-(@= str(data.values.stemcell_details.major_version) @)/.resource/version @@ -498,8 +503,8 @@ jobs: files: - candidate-(@= data.values.stemcell_details.os_name @)-fips-stemcell-(@= str(data.values.stemcell_details.major_version) @)/*.tgz options: - author_email: ci@localhost - author_name: CI Bot + author_email: *ci_bot_email + author_name: *ci_bot_name message: 'publish (heavy): (@= data.values.stemcell_details.os_name @)-fips/(@= str(data.values.stemcell_details.major_version) @).x' rename: '{{.Version}}/stemcells.meta4' version: candidate-(@= data.values.stemcell_details.os_name @)-fips-stemcell-(@= str(data.values.stemcell_details.major_version) @)/.resource/version @@ -508,8 +513,8 @@ jobs: files: - candidate-aws-light-stemcell/*.tgz options: - author_email: ci@localhost - author_name: CI Bot + author_email: *ci_bot_email + author_name: *ci_bot_name message: 'publish (light aws): (@= data.values.stemcell_details.os_name @)/(@= str(data.values.stemcell_details.major_version) @).x' rename: '{{.Version}}/stemcells.aws.meta4' version: candidate-aws-light-stemcell/.resource/version @@ -542,8 +547,8 @@ jobs: files: - candidate-google-light-(@= data.values.stemcell_details.os_name @)-stemcell-(@= str(data.values.stemcell_details.major_version) @)/*.tgz options: - author_email: ci@localhost - author_name: CI Bot + author_email: *ci_bot_email + author_name: *ci_bot_name message: 'publish (light google): (@= data.values.stemcell_details.os_name @)/(@= str(data.values.stemcell_details.major_version) @).x' rename: '{{.Version}}/stemcells.gcp.meta4' version: candidate-google-light-(@= data.values.stemcell_details.os_name @)-stemcell-(@= str(data.values.stemcell_details.major_version) @)/.resource/version diff --git a/ci/tasks/build.sh b/ci/tasks/build.sh index a068d6a8f6..e14dc284e0 100755 --- a/ci/tasks/build.sh +++ b/ci/tasks/build.sh @@ -135,6 +135,6 @@ cat "$meta4_path" cd "${REPO_PARENT}/stemcells-index-output" git add -A -git config --global user.email "ci@localhost" -git config --global user.name "CI Bot" +git config --global user.email "${GIT_USER_EMAIL}" +git config --global user.name "${GIT_USER_NAME}" git commit -m "dev: ${OS_NAME}-${OS_VERSION}/${CANDIDATE_BUILD_NUMBER} ($IAAS-$HYPERVISOR)" diff --git a/ci/tasks/build.yml b/ci/tasks/build.yml index fa1b8e1fa0..a2b41690c4 100644 --- a/ci/tasks/build.yml +++ b/ci/tasks/build.yml @@ -28,3 +28,5 @@ params: S3_API_ENDPOINT: s3.amazonaws.com ESM_TOKEN: AGENT_SUFFIX: -go_agent + GIT_USER_EMAIL: + GIT_USER_NAME: diff --git a/ci/tasks/bump-bosh-agent.sh b/ci/tasks/bump-bosh-agent.sh index 222828b5b7..ecc728b39a 100755 --- a/ci/tasks/bump-bosh-agent.sh +++ b/ci/tasks/bump-bosh-agent.sh @@ -23,8 +23,8 @@ cp "${REPO_PARENT}/bosh-agent/.resource/version" \ pushd "${REPO_PARENT}/bosh-linux-stemcell-builder-out" if [ "$(git status --porcelain)" != "" ]; then git add -A - git config --global user.email "ci@localhost" - git config --global user.name "CI Bot" + git config --global user.email "${GIT_USER_EMAIL}" + git config --global user.name "${GIT_USER_NAME}" git commit -m "bump bosh-agent/$version" fi popd diff --git a/ci/tasks/bump-bosh-agent.yml b/ci/tasks/bump-bosh-agent.yml index 2506ee1174..cf020c55a7 100644 --- a/ci/tasks/bump-bosh-agent.yml +++ b/ci/tasks/bump-bosh-agent.yml @@ -13,3 +13,7 @@ outputs: run: path: bosh-stemcells-ci/ci/tasks/bump-bosh-agent.sh + +params: + GIT_USER_EMAIL: + GIT_USER_NAME: diff --git a/ci/tasks/bump-bosh-blobstore-cli.sh b/ci/tasks/bump-bosh-blobstore-cli.sh index f82d23ca1a..6105e9876a 100755 --- a/ci/tasks/bump-bosh-blobstore-cli.sh +++ b/ci/tasks/bump-bosh-blobstore-cli.sh @@ -26,8 +26,8 @@ echo "${sha256sum}" > \ pushd "${REPO_PARENT}/bosh-linux-stemcell-builder-out" if [ "$(git status --porcelain)" != "" ]; then git add -A - git config --global user.email "ci@localhost" - git config --global user.name "CI Bot" + git config --global user.email "${GIT_USER_EMAIL}" + git config --global user.name "${GIT_USER_NAME}" git commit -m "bump bosh-blobstore-${BLOBSTORE_TYPE}/${version}" fi popd diff --git a/ci/tasks/bump-bosh-blobstore-cli.yml b/ci/tasks/bump-bosh-blobstore-cli.yml index b7f252fffd..39b1e92d3e 100644 --- a/ci/tasks/bump-bosh-blobstore-cli.yml +++ b/ci/tasks/bump-bosh-blobstore-cli.yml @@ -13,3 +13,7 @@ outputs: run: path: bosh-stemcells-ci/ci/tasks/bump-bosh-blobstore-cli.sh + +params: + GIT_USER_EMAIL: + GIT_USER_NAME: diff --git a/ci/tasks/commit-build-time.sh b/ci/tasks/commit-build-time.sh index 3d8688a1b9..7a89d6d699 100755 --- a/ci/tasks/commit-build-time.sh +++ b/ci/tasks/commit-build-time.sh @@ -16,7 +16,7 @@ formatted_build_time="$(date --date "${build_time%.*}" +%Y%m%dT%H%M%SZ)" pushd "${REPO_PARENT}/bosh-linux-stemcell-builder" echo "${formatted_build_time}" > build_time.txt git add -A - git config --global user.email "ci@localhost" - git config --global user.name "CI Bot" + git config --global user.email "${GIT_USER_EMAIL}" + git config --global user.name "${GIT_USER_NAME}" git commit -m "Commit Build Time" popd diff --git a/ci/tasks/commit-build-time.yml b/ci/tasks/commit-build-time.yml index b0c42dc158..0662900ac8 100644 --- a/ci/tasks/commit-build-time.yml +++ b/ci/tasks/commit-build-time.yml @@ -11,3 +11,7 @@ outputs: run: path: bosh-stemcells-ci/ci/tasks/commit-build-time.sh + +params: + GIT_USER_EMAIL: + GIT_USER_NAME: diff --git a/ci/tasks/publish.sh b/ci/tasks/publish.sh index 83fa273405..6b4fb067b6 100755 --- a/ci/tasks/publish.sh +++ b/ci/tasks/publish.sh @@ -10,7 +10,8 @@ if [[ -n "${DEBUG:-}" ]]; then export BOSH_LOG_PATH="${BOSH_LOG_PATH:-${REPO_PARENT}/bosh-debug.log}" fi -export VERSION=$( cat "${REPO_PARENT}/version/number" | sed 's/\.0$//;s/\.0$//' ) +VERSION=$( cat "${REPO_PARENT}/version/number" | sed 's/\.0$//;s/\.0$//' ) +export VERSION # # merge all stemcell files into a single metalink for publishing @@ -23,14 +24,14 @@ meta4_path="${REPO_PARENT}/stemcells-index-output/$TO_INDEX/$OS_NAME-$OS_VERSION mkdir -p "$( dirname "$meta4_path" )" meta4 create --metalink="$meta4_path" -find "${REPO_PARENT}/stemcells-index-output/$FROM_INDEX/$OS_NAME-$OS_VERSION/$VERSION" -name "*.meta4" \ - | xargs -n1 -- meta4 import-metalink --metalink="$meta4_path" +find "${REPO_PARENT}/stemcells-index-output/$FROM_INDEX/$OS_NAME-$OS_VERSION/$VERSION" -name "*.meta4" -print0 \ + | xargs --null -n1 -- meta4 import-metalink --metalink="$meta4_path" cd "${REPO_PARENT}/stemcells-index-output" git add -A -git config --global user.email "ci@localhost" -git config --global user.name "CI Bot" +git config --global user.email "${GIT_USER_EMAIL}" +git config --global user.name "${GIT_USER_NAME}" git commit -m "$COMMIT_PREFIX: $OS_NAME-$OS_VERSION/$VERSION" cd "${REPO_PARENT}" @@ -71,7 +72,8 @@ else # occasionally this fails for unexpected reasons; retry a few times for i in {1..4}; do - aws --endpoint-url=${AWS_ENDPOINT} s3 cp "s3://$FROM_BUCKET_NAME/$file" "s3://$TO_BUCKET_NAME/$file" \ + echo "'s3 cp' attempt: ${i}" >&2 + aws --endpoint-url="${AWS_ENDPOINT}" s3 cp "s3://$FROM_BUCKET_NAME/$file" "s3://$TO_BUCKET_NAME/$file" \ && break \ || sleep 5 done diff --git a/ci/tasks/publish.yml b/ci/tasks/publish.yml index d183b437a3..d80cdb2684 100644 --- a/ci/tasks/publish.yml +++ b/ci/tasks/publish.yml @@ -31,3 +31,5 @@ params: COPY_KEYS: required OS_NAME: required OS_VERSION: required + GIT_USER_EMAIL: + GIT_USER_NAME: