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

Publish to both main and master for the time being #1129

Merged
Merged
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
28 changes: 22 additions & 6 deletions .buildkite/steps/publish.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,28 @@ else
echo "Skipping publishing latest, '$BUILDKITE_TAG' doesn't match '$(git describe origin/master --tags --match='v*')'"
fi

# Publish the most recent commit from each branch
s3_upload_templates "${BUILDKITE_BRANCH}/"
publish_for_branch() {
local branch="$1"

# Publish each build to a unique URL, to let people roll back to old versions
s3_upload_templates "${BUILDKITE_BRANCH}/${BUILDKITE_COMMIT}."
# Publish the most recent commit from each branch
s3_upload_templates "${branch}/"

cat << EOF | buildkite-agent annotate --style "info"
Published template <a href="https://s3.amazonaws.com/${BUILDKITE_AWS_STACK_TEMPLATE_BUCKET}/${BUILDKITE_BRANCH}/aws-stack.yml">${BUILDKITE_BRANCH}/aws-stack.yml</a>
# Publish each build to a unique URL, to let people roll back to old versions
s3_upload_templates "${branch}/${BUILDKITE_COMMIT}."

cat << EOF | buildkite-agent annotate --style "info"
Published template <a href="https://s3.amazonaws.com/${BUILDKITE_AWS_STACK_TEMPLATE_BUCKET}/${branch}/aws-stack.yml">${branch}/aws-stack.yml</a>
EOF
}

if [[ "$BUILDKITE_BRANCH" != "$BUILDKITE_PIPELINE_DEFAULT_BRANCH" ]]; then
publish_for_branch "$BUILDKITE_BRANCH"

exit 0
fi

# TODO: remove "master" from this list
Copy link
Contributor

Choose a reason for hiding this comment

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

This is largely a hypothetical, but if we all forget what this was about, when would the right time to remove "master" be? 6 months from now?

Copy link
Contributor

@moskyb moskyb Jun 15, 2023

Choose a reason for hiding this comment

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

i'm a big fan of time bomb comments for this - eg # If you're reading this and the date is after YYYY-MM-DD the you should delete master from this list. it's a concrete call to action, and avoids both the bystander effect and the murky who/when/how of a TODO - the who is the reader, the when is right now, the how should be made clear by the comment, ideally

Copy link
Contributor

Choose a reason for hiding this comment

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

i remember ages ago finding a rust crate that was able to parse these and automatically fail CI if it found any hanging time bombs... lost to the sands of the internet now though

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I did make a ticket about it: https://linear.app/buildkite/issue/PDP-1110/remove-publishing-elastic-stack-to-master

I put it in the backlog. I think moving to PDP triage might make it more visible.

default_branch_aliases=(master main)
for branch in "${default_branch_aliases[@]}"; do
publish_for_branch "$branch"
done