- Notifications
You must be signed in to change notification settings - Fork 33
feat(distribution): provide rpm packages via rpm repository#1012
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
Merged
Uh oh!
There was an error while loading. Please reload this page.
Merged
Changes from all commits
Commits
Show all changes
37 commits Select commit Hold shift + click to select a range
e8d3dc0 skip goreleaser publish step
Benjosh95 c4c86d4 fix typo
Benjosh95 8f27d27 skip tag validation
Benjosh95 84df183 temporarily outcomment most builds
Benjosh95 6bd3486 add rpm release job and script
Benjosh95 0317c11 change nfpms signing to embedded
Benjosh95 cbf953a fix indentation
Benjosh95 4c7e6e5 add passphrase
Benjosh95 a332fd4 fix passphrase env
Benjosh95 fb156e5 remove ubuntu rpm package
Benjosh95 1225186 add particular endpoint flag
Benjosh95 de5d7fc fix deletion packages bug
Benjosh95 66956eb add gpg --batch to to signing of repo metadata
Benjosh95 7f198b6 download existing bucket rpm content and redo signing of metadata
Benjosh95 5992b0d fix duplicating metadata
Benjosh95 3cae183 insert apt again with test env for testing
Benjosh95 a77d896 WORKAROUND for apt mirror issue
Benjosh95 755ec0b WORKAROUND: fix aptly config for test env
Benjosh95 39e7d4d add DNF/YUM/Zypper installation Guide
Benjosh95 e1e1958 remove the apt testing stuff and isolation work again after successfu…
Benjosh95 afb2cb5 improve installation docs
Benjosh95 4e5548a remove duplicate message leftover
Benjosh95 9bdaa6d publish rpm script improvement - regarding - sync
Benjosh95 d982c2d add release comments
Benjosh95 5af38d8 remove some comments goreleaser
Benjosh95 067d3dd fix installing typo
Benjosh95 3b82b58 remove installation auto-confirmation
Benjosh95 1f9e88e fix unused variable
Benjosh95 8061c88 fix quotes codesplitting
Benjosh95 0b7f098 fix unused keyring
Benjosh95 71bf833 fix printf
Benjosh95 7f50890 fix filelist using find
Benjosh95 c616761 remove comment, fix gpg cleanup
Benjosh95 051cacb fix gpg key storage
Benjosh95 bb4effa add key redundancy comment
Benjosh95 5081b7d updating links to point to production
Benjosh95 c6a7434 fix installation docs
Benjosh95 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -99,17 +99,10 @@ nfpms: | ||
| - deb | ||
| - rpm | ||
| signs: | ||
| - artifacts: package | ||
| args: | ||
| [ | ||
| "-u", | ||
| "{{.Env.GPG_FINGERPRINT }}", | ||
| "--output", | ||
| "${signature}", | ||
| "--detach-sign", | ||
| "${artifact}", | ||
| ] | ||
| rpm: | ||
| # The package is signed if a key_file is set | ||
| signature: | ||
| key_file: "{{.Env.GPG_KEY_PATH }}" | ||
Benjosh95 marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading. Please reload this page. | ||
| homebrew_casks: | ||
| - name: stackit | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,112 @@ | ||
| #!/usr/bin/env bash | ||
| # This script is used to publish new RPM packages to the CLI RPM repository | ||
| # Usage: ./publish-rpm-packages.sh | ||
| set -eo pipefail | ||
| PACKAGES_BUCKET_URL="https://packages.stackit.cloud" | ||
| PUBLIC_KEY_FILE_PATH="keys/key.gpg" | ||
| RPM_REPO_PATH="rpm/cli" | ||
| RPM_BUCKET_NAME="distribution" | ||
| GORELEASER_PACKAGES_FOLDER="dist/" | ||
| # We need to disable the key database daemon (keyboxd) | ||
| # This can be done by removing "use-keyboxd" from ~/.gnupg/common.conf (see https://github.com/gpg/gnupg/blob/master/README) | ||
| echo -n >~/.gnupg/common.conf | ||
| # Create RPM repository directory structure | ||
| printf ">>> Creating RPM repository structure \n" | ||
| mkdir -p rpm-repo/x86_64 | ||
| mkdir -p rpm-repo/i386 | ||
| mkdir -p rpm-repo/aarch64 | ||
| # Copy RPM packages to appropriate architecture directories | ||
| printf "\n>>> Copying RPM packages to architecture directories \n" | ||
| # Copy x86_64 packages (amd64) | ||
| for rpm_file in "${GORELEASER_PACKAGES_FOLDER}"*_amd64.rpm; do | ||
| if [ -f "$rpm_file" ]; then | ||
| cp "$rpm_file" rpm-repo/x86_64/ | ||
| printf "Copied %s to x86_64/\n" "$(basename "$rpm_file")" | ||
| fi | ||
| done | ||
| # Copy i386 packages | ||
| for rpm_file in "${GORELEASER_PACKAGES_FOLDER}"*_386.rpm; do | ||
| if [ -f "$rpm_file" ]; then | ||
| cp "$rpm_file" rpm-repo/i386/ | ||
| printf "Copied %s to i386/\n" "$(basename "$rpm_file")" | ||
| fi | ||
| done | ||
| # Copy aarch64 packages (arm64) | ||
| for rpm_file in "${GORELEASER_PACKAGES_FOLDER}"*_arm64.rpm; do | ||
| if [ -f "$rpm_file" ]; then | ||
| cp "$rpm_file" rpm-repo/aarch64/ | ||
| printf "Copied %s to aarch64/\n" "$(basename "$rpm_file")" | ||
| fi | ||
| done | ||
| # Download existing repository content (RPMs and metadata) if it exists | ||
| printf "\n>>> Downloading existing repository content \n" | ||
| aws s3 sync s3://${RPM_BUCKET_NAME}/${RPM_REPO_PATH}/ rpm-repo/ --endpoint-url "${AWS_ENDPOINT_URL}" --exclude "*.asc" || echo "No existing repository found, creating new one" | ||
| # Create repository metadata for each architecture | ||
| printf "\n>>> Creating repository metadata \n" | ||
| for arch in x86_64 i386 aarch64; do | ||
| if [ -d "rpm-repo/${arch}" ] && [ -n "$(find "rpm-repo/${arch}" -mindepth 1 -maxdepth 1 -print -quit)" ]; then | ||
| printf "Creating metadata for %s...\n" "$arch" | ||
| # List what we're working with | ||
| file_list=$(find "rpm-repo/${arch}" -maxdepth 1 -type f -exec basename{} \; | tr '\n' ' ') | ||
| printf "Files in %s: %s\n" "$arch" "${file_list% }" | ||
| # Create repository metadata | ||
| createrepo_c --update rpm-repo/${arch} | ||
| # Sign the repository metadata | ||
| printf "Signing repository metadata for %s...\n" "$arch" | ||
| # Remove existing signature file if it exists | ||
| rm -f rpm-repo/${arch}/repodata/repomd.xml.asc | ||
| gpg --batch --pinentry-mode loopback --detach-sign --armor \ | ||
| --local-user "${GPG_PRIVATE_KEY_FINGERPRINT}" \ | ||
| --passphrase "${GPG_PASSPHRASE}" \ | ||
| rpm-repo/${arch}/repodata/repomd.xml | ||
| # Verify the signature was created | ||
| if [ -f "rpm-repo/${arch}/repodata/repomd.xml.asc" ]; then | ||
| printf "Repository metadata signed successfully for %s\n" "$arch" | ||
| else | ||
| printf "WARNING: Repository metadata signature not created for %s\n" "$arch" | ||
| fi | ||
| else | ||
| printf "No packages found for %s, skipping...\n" "$arch" | ||
| fi | ||
| done | ||
| # Upload the updated repository to S3 in two phases (repodata pointers last) | ||
| # clients reading the repo won't see a state where repomd.xml points to files not uploaded yet. | ||
| printf "\n>>> Uploading repository to S3 (phase 1: all except repomd*) \n" | ||
| aws s3 sync rpm-repo/ s3://${RPM_BUCKET_NAME}/${RPM_REPO_PATH}/ \ | ||
| --endpoint-url "${AWS_ENDPOINT_URL}" \ | ||
| --delete \ | ||
| --exclude "*/repodata/repomd.xml" \ | ||
| --exclude "*/repodata/repomd.xml.asc" | ||
| printf "\n>>> Uploading repository to S3 (phase 2: repomd* only) \n" | ||
| aws s3 sync rpm-repo/ s3://${RPM_BUCKET_NAME}/${RPM_REPO_PATH}/ \ | ||
| --endpoint-url "${AWS_ENDPOINT_URL}" \ | ||
| --exclude "*" \ | ||
| --include "*/repodata/repomd.xml" \ | ||
| --include "*/repodata/repomd.xml.asc" | ||
| # Upload the public key | ||
| # Also uploaded in APT publish; intentionally redundant | ||
| # Safe to overwrite and ensures updates if APT fails or key changes. | ||
| printf "\n>>> Uploading public key \n" | ||
| gpg --armor --export "${GPG_PRIVATE_KEY_FINGERPRINT}" > public-key.asc | ||
| aws s3 cp public-key.asc s3://${RPM_BUCKET_NAME}/${PUBLIC_KEY_FILE_PATH} --endpoint-url "${AWS_ENDPOINT_URL}" | ||
Benjosh95 marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading. Please reload this page. | ||
| printf "\n>>> RPM repository published successfully! \n" | ||
| printf "Repository URL: %s/%s/ \n" "$PACKAGES_BUCKET_URL" "$RPM_REPO_PATH" | ||
| printf "Public key URL: %s/%s \n" "$PACKAGES_BUCKET_URL" "$PUBLIC_KEY_FILE_PATH" | ||
Oops, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.