Skip to content
This repository was archived by the owner on Mar 4, 2025. It is now read-only.

Commit 347a7a7

Browse files
authored
Linux artifacts signing (#447)
* sign-artifacts-new * fix yaml * fix yaml * sign-artifacts * change image * rename * fix image * Some easy Python code * format py * Remove unused dockerfile * Add more args * Refactor * Implement signing * Refine assert msg * Use a single subir * Use /templates/.sign-client.yml * Fix yaml * Fix setting archive option * Remove signing scripts * Add required env vars * Fix bad env var name for OPTIONS * Fix ordering and artifacts * Sign single files * Fix scripts * Fix checksums job * Remove uncessary spaces * Add missing stage * Fix typo * Nit fixes * Checksums for all artifacts * Little improvements
1 parent 5bb1730 commit 347a7a7

File tree

4 files changed

+72
-59
lines changed

4 files changed

+72
-59
lines changed

.gitignore

+5-1
Original file line numberDiff line numberDiff line change
@@ -356,5 +356,9 @@ tracer/test/test-applications/integrations/dependency-libs/Samples.AlwaysOnProfi
356356
.ionide/
357357
/devenv.bat
358358

359+
# GitLab pipeline artifacts
360+
dist/
361+
signed/
362+
359363
# benchmark test results directory
360-
/dev-aop/results
364+
/dev-aop/results

.gitlab-ci.yml

+67-26
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
1-
workflow:
2-
rules:
3-
- if: '$CI_COMMIT_TAG =~ /^v/'
1+
include:
2+
# repo: https://cd.splunkdev.com/core-ee/signing/api-integration/-/tree/develop/
3+
- project: core-ee/signing/api-integration
4+
ref: develop
5+
file: /templates/.sign-client.yml
46

57
stages:
68
- build
7-
- verify
9+
- sign
10+
- checksum
11+
- checksum-sign
812

913
linux-build:
1014
stage: build
@@ -48,30 +52,67 @@ linux-build:
4852
# - tracer/bin/artifacts/nuget/SignalFx.NET.Tracing.Azure.Site.Extension.*.nupkg
4953
# - tracer/bin/artifacts/*/en-us
5054

51-
verify-artifacts:
52-
stage: verify
55+
sign-deb:
56+
stage: sign
57+
extends: .submit-request
58+
dependencies:
59+
- linux-build
60+
before_script:
61+
- cp -vfp $(ls dist/*.deb) package.deb
62+
after_script:
63+
- mkdir signed
64+
- mv -vf tmp/package.deb "signed/$(basename $(ls dist/*.deb))"
5365
variables:
54-
dotnetSdkVersion: 6.0.200
55-
script:
56-
- |
57-
rm .dockerignore
58-
- |
59-
docker build \
60-
--build-arg DOTNETSDK_VERSION=${dotnetSdkVersion} \
61-
--tag splunk-trace-dotnet/checksums \
62-
--file "./tracer/build/_build/docker/dotnet.dockerfile" \
63-
.
64-
- |
65-
docker run \
66-
--env artifacts=/project/dist \
67-
--name checksums \
68-
splunk-trace-dotnet/checksums \
69-
tracer/build.sh ChecksumArtifacts
70-
- |
71-
docker cp checksums:/project/dist/checksums.txt dist/checksums.txt
66+
PROJECT: signalfx-dotnet-tracing
67+
ARTIFACT: package.deb
68+
SIGN_TYPE: DEB
69+
DOWNLOAD_DIR: tmp
70+
REPO_NAME: releng # this env var should be not needed in future
71+
REPO_PATH: signalfx-dotnet-tracing # this env var should be not needed in future
72+
artifacts:
73+
paths:
74+
- signed/
75+
76+
sign-rpm:
77+
stage: sign
78+
extends: .submit-request
7279
dependencies:
7380
- linux-build
81+
before_script:
82+
- cp -vfp $(ls dist/*.rpm) package.rpm
83+
after_script:
84+
- mkdir signed
85+
- mv -vf tmp/package.rpm "signed/$(basename $(ls dist/*.rpm))"
86+
variables:
87+
PROJECT: signalfx-dotnet-tracing
88+
ARTIFACT: package.rpm
89+
SIGN_TYPE: RPM
90+
DOWNLOAD_DIR: tmp
91+
REPO_NAME: releng # this env var should be not needed in future
92+
REPO_PATH: signalfx-dotnet-tracing # this env var should be not needed in future
93+
artifacts:
94+
paths:
95+
- signed/
96+
97+
checksums:
98+
stage: checksum
99+
script:
100+
- cp -vnpr dist/. signed # copy artifacts that are not signed
101+
- pushd signed && shasum -a 256 * > checksums.txt && popd
102+
artifacts:
103+
paths:
104+
- signed/
105+
106+
checksums-sign:
107+
stage: checksum-sign
108+
extends: .submit-request
109+
variables:
110+
PROJECT: signalfx-dotnet-tracing
111+
ARTIFACT: signed/checksums.txt
112+
SIGN_TYPE: GPG
113+
DOWNLOAD_DIR: signed
114+
REPO_NAME: releng # this env var should be not needed in future
115+
REPO_PATH: signalfx-dotnet-tracing # this env var should be not needed in future
74116
artifacts:
75117
paths:
76-
- dist/checksums.txt
77-
118+
- signed/

tracer/build/_build/Build.Steps.cs

-27
Original file line numberDiff line numberDiff line change
@@ -653,33 +653,6 @@ partial class Build
653653
}
654654
});
655655

656-
Target ChecksumArtifacts => _ => _
657-
.Requires(() => Artifacts)
658-
.Executes(() =>
659-
{
660-
var artifacts = Directory.GetFiles(Artifacts);
661-
var checksums = new StringBuilder();
662-
663-
foreach (var artifact in artifacts)
664-
{
665-
Logger.Info($"Found artifact '{artifact}'");
666-
667-
using (var sha256 = SHA256.Create())
668-
using (var stream = File.OpenRead(artifact))
669-
{
670-
var fileName = Path.GetFileName(artifact);
671-
var hash = BitConverter.ToString(sha256.ComputeHash(stream)).Replace("-", string.Empty);
672-
673-
checksums.AppendLine($"{hash} {fileName}");
674-
}
675-
}
676-
677-
var checksumsPath = Path.Combine(Artifacts, "checksums.txt");
678-
679-
Logger.Info($"Generating checksums file: '{checksumsPath}'");
680-
File.WriteAllText(checksumsPath, checksums.ToString());
681-
});
682-
683656
Target CompileManagedTestHelpers => _ => _
684657
.Unlisted()
685658
.After(Restore)

tracer/build/_build/docker/dotnet.dockerfile

-5
This file was deleted.

0 commit comments

Comments
 (0)