Skip to content

Commit

Permalink
Fix gitlab release (open-telemetry#491)
Browse files Browse the repository at this point in the history
* Fix github-release

* Stage artifact uniquely for signing concurrency
  • Loading branch information
jeffreyc-splunk committed Jun 18, 2021
1 parent 6211006 commit bb36250
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
8 changes: 4 additions & 4 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -256,14 +256,14 @@ github-release:
variables:
- $CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+.*/
stage: github-release
before_script:
- mkdir -p dist/assets
script:
- mkdir -p dist/assets
- cp bin/otelcol_linux_* dist/assets/
- cp dist/signed/* dist/assets/
- cd dist/assets && shasum -a 256 * > checksums.txt
- ghr -t $GITHUB_TOKEN -u signalfx -r splunk-otel-collector --replace "$CI_COMMIT_TAG" dist/assets/
- pushd dist/assets && shasum -a 256 * > checksums.txt && popd
- ghr -t "$GITHUB_TOKEN" -u signalfx -r splunk-otel-collector --replace "$CI_COMMIT_TAG" dist/assets/
artifacts:
when: always
paths:
- dist/assets

Expand Down
8 changes: 6 additions & 2 deletions internal/buildscripts/packaging/release/helpers/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@

import hashlib
import os
import random
import re
import shutil
import string
import sys
import tempfile
import time
Expand Down Expand Up @@ -261,7 +263,9 @@ def sign_file(src, dest, sign_type, src_user=None, src_token=None, timeout=DEFAU
assert sign_type.upper() in SIGN_TYPES, f"sign type '{sign_type}' not supported"

base = os.path.basename(src)
staged_artifact_url = f"{STAGING_REPO_URL}/{base}"
subdir = ''.join(random.choices(string.ascii_lowercase + string.digits, k=8))
staged_artifact_dir = f"{STAGING_REPO_URL}/{subdir}"
staged_artifact_url = f"{staged_artifact_dir}/{base}"

try:
with tempfile.TemporaryDirectory() as tmpdir:
Expand All @@ -280,7 +284,7 @@ def sign_file(src, dest, sign_type, src_user=None, src_token=None, timeout=DEFAU
download_file(signed_artifact_url, dest, staging_user, staging_token)
finally:
if artifactory_file_exists(staged_artifact_url, staging_user, staging_token):
delete_artifactory_file(staged_artifact_url, staging_user, staging_token)
delete_artifactory_file(staged_artifact_dir, staging_user, staging_token)


def sign_artifactory_metadata(src, artifactory_user, artifactory_token, timeout=DEFAULT_TIMEOUT, **signing_args):
Expand Down

0 comments on commit bb36250

Please sign in to comment.