Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sign the chart [ONPREM-440] #64

Merged
merged 4 commits into from
Jul 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 22 additions & 2 deletions .circleci/config.yml
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ workflows:
jobs:
- validate
- check_readme
- package
- package:
context: runner-signing
- smoke-tests:
context: runner-deploy
requires: [ validate ]
Expand Down Expand Up @@ -97,7 +98,26 @@ jobs:
- checkout
- attach_workspace:
at: .
- run: ./do package
- run:
name: "Install signing keys"
command: |
exec 2>/dev/null

echo "Importing signing keys"
echo -n "${SIGNING_KEY_ENCODED}" | base64 --decode >signing_key_decoded.key
gpg --batch --yes --passphrase "${SIGNING_KEY_PASSPHRASE}" --import signing_key_decoded.key
rm signing_key_decoded.key
curl https://keys.openpgp.org/vks/v1/by-fingerprint/"${GPG_ID}" >pub-key.asc
christian-stephen marked this conversation as resolved.
Show resolved Hide resolved
gpg --import pub-key.asc
rm pub-key.asc

echo "Convert to legacy gpg format per Helm requirements"
gpg --export >~/.gnupg/pubring.gpg
gpg --batch --yes --pinentry-mode=loopback --passphrase "${SIGNING_KEY_PASSPHRASE}" --export-secret-keys "${GPG_ID}" >~/.gnupg/secring.gpg
- run:
name: "Package and sign chart"
command: |
echo "${SIGNING_KEY_PASSPHRASE}" | ./do package sign --passphrase-file -
- persist_to_workspace:
root: .
paths: [ ./target ]
Expand Down
1 change: 1 addition & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

# Edge

[#64](https://github.com/CircleCI-Public/container-runner-helm-chart/pull/64) Start signing the Helm chart to ensure provenance: https://helm.sh/docs/topics/provenance/
[#59](https://github.com/CircleCI-Public/container-runner-helm-chart/pull/59) Fix service container config example & update test

# 101.1.1
Expand Down
18 changes: 17 additions & 1 deletion do
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,24 @@ package() {
mkdir -p target
cd target

local arg="${1:-}"
if [ -n "${arg}" ]; then
shift
fi

echo 'Package Helm chart'
helm package ..
case ${arg} in
"sign")
echo 'Sign Helm chart'
# shellcheck disable=SC2086
helm package --sign --key "${KEY:-<[email protected]>}" --keyring ${KEYRING:-~/.gnupg/secring.gpg} .. "$@"
echo 'Verify Helm chart signature'
helm verify ./container-agent-*.tgz
;;
*)
helm package ..
;;
esac

echo 'Check contents of Helm package'
ls .
Expand Down