Skip to content

Commit

Permalink
Artifact encoding fix (#4230)
Browse files Browse the repository at this point in the history
* fix tags_to_sign by converting it to utf-8

* remove redundant line
  • Loading branch information
bmeller authored Jan 31, 2024
1 parent 19bd610 commit 197ac4f
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ fossa:
stage: sign-image
script:
- echo "listing images to be signed"
- cat $CI_PROJECT_DIR/tags_to_sign
- cat $CI_PROJECT_DIR/tags_to_sign | xargs -L1 artifact-ci sign docker
- cat tags_to_sign
- cat tags_to_sign | xargs -L1 artifact-ci sign docker


.get-artifactory-stage: &get-artifactory-stage
Expand Down Expand Up @@ -617,7 +617,7 @@ push-linux-image:
echo "Tagging and pushing ${IMAGE_NAME}:${ARCH_TAG}"
docker tag otelcol:${arch} ${IMAGE_NAME}:${ARCH_TAG}
docker push ${IMAGE_NAME}:${ARCH_TAG}
echo "${IMAGE_NAME}:${ARCH_TAG}" >> $CI_PROJECT_DIR/tags_to_sign
echo "${IMAGE_NAME}:${ARCH_TAG}" >> tags
if [[ "${CI_COMMIT_BRANCH:-}" = "main" ]] || [[ "${CI_COMMIT_TAG:-}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
# only push latest tag for main and stable releases; no need to sign them as signing is made for digest
LATEST_TAG="latest-${arch}"
Expand All @@ -643,13 +643,14 @@ push-linux-image:
- docker inspect --format='{{.RepoDigests}}' ${IMAGE_NAME}:${MANIFEST_TAG}-arm64 | tee dist/linux_arm64_digest.txt
- docker inspect --format='{{.RepoDigests}}' ${IMAGE_NAME}:${MANIFEST_TAG}-ppc64le | tee dist/linux_ppc64le_digest.txt
- docker manifest inspect ${IMAGE_NAME}:${MANIFEST_TAG} | tee dist/manifest_digest.txt
- mv tags tags_to_sign
artifacts:
paths:
- dist/linux_amd64_digest.txt
- dist/linux_arm64_digest.txt
- dist/linux_ppc64le_digest.txt
- dist/manifest_digest.txt
- $CI_PROJECT_DIR/tags_to_sign
- tags_to_sign

sign-linux-image:
extends: .sign-docker
Expand Down Expand Up @@ -684,20 +685,21 @@ build-push-windows-image:
docker build -t ${IMAGE_NAME}:${IMAGE_TAG} --build-arg BASE_IMAGE=mcr.microsoft.com/windows/servercore:1809 --build-arg JMX_METRIC_GATHERER_RELEASE=${JMX_METRIC_GATHERER_RELEASE} -f .\cmd\otelcol\Dockerfile.windows .\cmd\otelcol\
echo "Pushing ${IMAGE_NAME}:${IMAGE_TAG}"
docker push ${IMAGE_NAME}:${IMAGE_TAG}
echo "${IMAGE_NAME}:${IMAGE_TAG}" >> $CI_PROJECT_DIR/tags_to_sign
echo "${IMAGE_NAME}:${IMAGE_TAG}" >> tags
if ($env:CI_COMMIT_BRANCH -eq "main" -or $env:CI_COMMIT_TAG -match '^v\d+\.\d+\.\d+$') {
# only push latest tag for main and stable releases; no need to sign them as signing is made for digest
echo "Tagging and pushing ${IMAGE_NAME}:latest"
docker tag ${IMAGE_NAME}:${IMAGE_TAG} ${IMAGE_NAME}:latest
docker push ${IMAGE_NAME}:latest
}
- docker inspect --format='{{.RepoDigests}}' ${IMAGE_NAME}:${IMAGE_TAG} | Tee-Object -FilePath dist/windows_digest.txt
- cat tags | Out-File -Encoding UTF8 tags_to_sign
after_script:
- docker image prune --all --force
artifacts:
paths:
- dist/windows_digest.txt
- $CI_PROJECT_DIR/tags_to_sign
- tags_to_sign

sign-windows-image:
extends: .sign-docker
Expand Down Expand Up @@ -733,21 +735,22 @@ build-push-windows2022-image:
docker build -t ${IMAGE_NAME}:${IMAGE_TAG} --build-arg BASE_IMAGE=mcr.microsoft.com/windows/servercore:ltsc2022 --build-arg JMX_METRIC_GATHERER_RELEASE=${JMX_METRIC_GATHERER_RELEASE} -f .\cmd\otelcol\Dockerfile.windows .\cmd\otelcol\
echo "Pushing ${IMAGE_NAME}:${IMAGE_TAG}"
docker push ${IMAGE_NAME}:${IMAGE_TAG}
echo "${IMAGE_NAME}:${IMAGE_TAG}" >> $CI_PROJECT_DIR/tags_to_sign
echo "${IMAGE_NAME}:${IMAGE_TAG}" >> tags
if ($env:CI_COMMIT_BRANCH -eq "main" -or $env:CI_COMMIT_TAG -match '^v\d+\.\d+\.\d+$') {
# only push latest tag for main and stable releases; no need to sign them as signing is made for digest
echo "Tagging and pushing ${IMAGE_NAME}:latest-2022"
docker tag ${IMAGE_NAME}:${IMAGE_TAG} ${IMAGE_NAME}:latest-2022
docker push ${IMAGE_NAME}:latest-2022
}
- docker inspect --format='{{.RepoDigests}}' ${IMAGE_NAME}:${IMAGE_TAG} | Tee-Object -FilePath dist/windows_2022_digest.txt
- cat tags | Out-File -Encoding UTF8 tags_to_sign
after_script:
- docker image prune --all --force
- C:\Users\Administrator\Desktop\ops-scripts\docker-leak-check.exe -remove
artifacts:
paths:
- dist/windows_2022_digest.txt
- $CI_PROJECT_DIR/tags_to_sign
- tags_to_sign

sign-windows2022-image:
extends: .sign-docker
Expand Down

0 comments on commit 197ac4f

Please sign in to comment.