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

feat(publish): set aptly Origin + Label #59

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
4 changes: 3 additions & 1 deletion scripts/sync-and-publish
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ set -xeuo pipefail
release=$1
opt=${2:-false}
nightly=false
origin="Mattermost"
Copy link

@ghost ghost Apr 11, 2022

Choose a reason for hiding this comment

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

Is it possible to fetch origin and label from arguments and make them mandatory?

So that we can distinguish packages by origin. As Mattermost we may want to set origin from CI/CD pipeline to determine officially generated packages. And for anyone who builds and publish to their own repository, they may want to use different origin and label value.

Copy link
Member

Choose a reason for hiding this comment

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

pretty good point yes

Copy link
Author

Choose a reason for hiding this comment

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

Is it possible to fetch origin and label from arguments and make them mandatory?

Currently, the script takes two parameters:

  1. release
  2. (optional) opt

Should origin and label be mandatory parameters 2 and 3 as follows:

  1. release
  2. origin
  3. label
  4. (optional) opt

Or might you prefer to facilitate environment variables APT_RELEASE, APT_ORIGIN and APT_LABEL for this? The script could still fail if those are not set.

Copy link

@ghost ghost Apr 13, 2022

Choose a reason for hiding this comment

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

Thank you very much, using enviroment veriables is great idea.

And since we will have multiple parameters, using environment variables will increase readability and flexibility.

./sync-and-publish bionic "Mattermost" "Mattermost Omnibus" --nightly

-vs-

APT_RELEASE="bionic" APT_ORIGIN="Mattermost" APT_LABEL="Mattermost Omnibus" ./sync-and-publish --nightly

It will be nice to use Environment variables and both of them are okay.

label="Mattermost Omnibus"

if [[ "${release}" != "bionic" && "${release}" != "focal" ]]; then
printf "ERROR: unsupported release %q\n" "${release}" >&2
Expand Down Expand Up @@ -34,4 +36,4 @@ else
fi
aptly snapshot create ${release}-snapshot from repo ${release}-repo
cp scripts/aptly.conf $HOME/.aptly.conf
aptly publish snapshot -batch -force-overwrite -gpg-key="${GPG_KEY_ID}" ${release}-snapshot "s3:remote:"
aptly publish snapshot -batch -force-overwrite -gpg-key="${GPG_KEY_ID}" -origin="${origin}" -label="${label}" ${release}-snapshot "s3:remote:"