Skip to content

Build: Save build artifact and publish release#2633

Merged
mattklein123 merged 11 commits intoenvoyproxy:masterfrom
taion809:feat-add-linux-binaries
Mar 14, 2018
Merged

Build: Save build artifact and publish release#2633
mattklein123 merged 11 commits intoenvoyproxy:masterfrom
taion809:feat-add-linux-binaries

Conversation

@taion809
Copy link
Contributor

@taion809 taion809 commented Feb 16, 2018

Description:
This pull request saves the release binary to
circleci artifacts. Additionally adds a release
script to create and publish a github release with
the linux binary attached to the github release as an asset.

A CNCF member will need to:

  • create a github token with repo access to cut releases and upload artifacts
  • Add the following environment variables to the circleci envoy project
    • GITHUB_TOKEN
    • GITHUB_USER
    • GITHUB_REPO

Risk Level: low

Testing:
I manually tested using this github repo:
https://github.com/taion809/envoy-build-tests

fixes #2095

Signed-off-by: Nicholas Johns nicholas.a.johns5@gmail.com

Description:
This pull request saves the release binary to
circleci artifacts.  Additionally adds a release
script to create and publish a github release with
the linux binary attached to the github release as an asset.

Risk Level: low

Testing:
I manually tested using this github repo:
https://github.com/taion809/envoy-build-tests

Signed-off-by: Nicholas Johns <nicholas.a.johns5@gmail.com>
Signed-off-by: Nicholas Johns <nicholas.a.johns5@gmail.com>
@dnoe
Copy link
Contributor

dnoe commented Feb 16, 2018

Looks like there is some issue with this on CircleCI. Do you have enough info to debug?

@taion809
Copy link
Contributor Author

yep, it looks like the initial release step moves the gitconfig file, so we just need to wrap it in a test

Signed-off-by: Nicholas Johns <nicholas.a.johns5@gmail.com>
ci/do_ci.sh Outdated

if [[ -n "${TAG:-}" ]]; then
ghrelease release --tag "${TAG:-}" --user taion809 --repo envoy-build-tests --name "${TAG:-}"
ghrelease upload --tag "${TAG:-}" --user taion809 --repo envoy-build-tests --name "envoy-linux-amd64" --file "${ENVOY_SRCDIR}/build_release_stripped/envoy"
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this need to be parameterized somehow to publish to a CNCF user? Looks like this is using your credentials somehow unless I misunderstand it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

😱

yeah it does, that should have been removed.

@dnoe dnoe self-assigned this Feb 16, 2018
Signed-off-by: Nicholas Johns <nicholas.a.johns5@gmail.com>
@taion809
Copy link
Contributor Author

@dnoe Updated, i've also updated the PR description with some prerequisite work

ci/do_ci.sh Outdated
docs/publish.sh
exit 0
elif [[ "$1" == "github_release" ]]; then
if [[ ! -f "${ENVOY_SRCDIR}/build_release_stripped/envoy" ]]; then
Copy link
Member

Choose a reason for hiding this comment

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

Can you move this into a new script ci/publish_github_release.sh? There's a fair bit of logic here that would be easier to understand in isolation. In the new script, can you also add a comment at the top explicitly warning not to set set -x debug, since we can get dangerous leakage of GH creds via CI logs if we don't take this step. This hit us previously in Docker CI image push, see https://github.com/envoyproxy/envoy/blob/master/ci/build_container/docker_push.sh#L3.

ci/do_ci.sh Outdated
if [[ ! -f "${ENVOY_SRCDIR}/build_release_stripped/envoy" ]]; then
echo "could not locate envoy binary at path: ${ENVOY_SRCDIR}/build_release_stripped/envoy"

# TODO(taion809): discuss whether or not failing to publish to github warrents failing the build itself
Copy link
Member

Choose a reason for hiding this comment

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

I think misconfiguration that is this bad, i.e. we're in a completely unexpected environment, should warrant failure via exit 1.

Signed-off-by: Nicholas Johns <nicholas.a.johns5@gmail.com>
@taion809 taion809 force-pushed the feat-add-linux-binaries branch from 724ae6e to 442f364 Compare February 18, 2018 16:27
Signed-off-by: Nicholas Johns <nicholas.a.johns5@gmail.com>
Copy link
Member

@htuch htuch left a comment

Choose a reason for hiding this comment

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

LGTM, if you can address the TODOs we can ship..

echo "environment variable GITHUB_TOKEN unset; cannot continue with publishing."

# TODO(taion809): discuss whether or not failing to publish to github warrents failing the build itself
exit 0
Copy link
Member

Choose a reason for hiding this comment

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

Yeah, please make these all exit 1, I think if we don't have the expected envs, then something has gone badly wrong and we should be notified early.

Signed-off-by: Nicholas Johns <nicholas.a.johns5@gmail.com>
@taion809
Copy link
Contributor Author

@htuch addressed

from the circleci side the environment variables will need to be added prior to cutting a release

htuch
htuch previously approved these changes Feb 21, 2018
Copy link
Member

@htuch htuch left a comment

Choose a reason for hiding this comment

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

Thanks!

@htuch
Copy link
Member

htuch commented Feb 22, 2018

@taion809 this is ready to ship when we have the CircleCI changes made.

@htuch
Copy link
Member

htuch commented Feb 28, 2018

@taion809 friendly ping.

steps:
- checkout
- run: ci/do_circle_ci.sh bazel.release
- run: ci/do_circle_ci.sh github_release
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this will be run on every repository event, resulting in a release created for every merge?

We've historically handled this by adding a check in the script to only publish/release for tag events. Here's an example

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this should be fixed, great catch!

Signed-off-by: Nicholas Johns <nicholas.a.johns5@gmail.com>
@taion809 taion809 force-pushed the feat-add-linux-binaries branch from 2fb00b3 to 9ee83f6 Compare February 28, 2018 21:53
Signed-off-by: Nicholas Johns <nicholas.a.johns5@gmail.com>
exit 1
fi

if [[ -z "${CIRCLE_TAG:-}" ]]; then
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd move this to be the very first check since this file runs on every build. We should bail early if it's not a tag event rather than failing on unnecessary dependencies

Signed-off-by: Nicholas Johns <nicholas.a.johns5@gmail.com>
cp /tmp/bin/linux/amd64/github-release /usr/local/bin/ghrelease
chmod +x /usr/local/bin/ghrelease

ghrelease release --tag "${CIRCLE_TAG:-}" --name "${CIRCLE_TAG:-}"
Copy link
Contributor

@bndw bndw Feb 28, 2018

Choose a reason for hiding this comment

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

@taion809 From a cursory look, this appears to create a Github release?

Currently, I think the process is roughly as follows:

  1. @mattklein123 manually creates a release on Github
  2. CircleCI receives a webhook with $CIRCLE_TAG set to the tag e.g. v1.5.0
  3. Scripts that need to do things on releases, like publish Docker images, check for the existence of $CIRCLE_TAG.

So I think this needs to be changed to add the binary to the existing Github release, rather than creating a release, otherwise we'll need to revise the release process for Envoy.

releases are done manually today through the github interface
so we should only upload a file to the existing release.

Signed-off-by: Nicholas Johns <nicholas.a.johns5@gmail.com>
@bndw
Copy link
Contributor

bndw commented Feb 28, 2018

LGTM

Once merged we'll need to do a test release to validate functionality, cc @mattklein123

@htuch
Copy link
Member

htuch commented Mar 1, 2018

@taion809 waiting for your go-ahead to merge.

@taion809
Copy link
Contributor Author

taion809 commented Mar 1, 2018

@htuch SGTM

cc @mattklein123 we need the above env var's in the envoy circleci project before the next release is cut

@mattklein123
Copy link
Member

@taion809 ACK. @htuch and others, let's leave this open until I'm back in the office in a week and a half and I can merge this and setup the creds and do some tests, etc.

@mattklein123 mattklein123 assigned mattklein123 and unassigned dnoe and htuch Mar 2, 2018
@mattklein123
Copy link
Member

Assigning to myself to merge this when I'm back.

@mattklein123
Copy link
Member

@taion809 getting back to this. Am I reading this correct that this requires a bot user? Is there any way to do this using a deploy key?

@taion809
Copy link
Contributor Author

i replied in slack, but for consistency i'll put it here too

I'm not sure it's possible with deploy keys, as far as I know deploy keys only give you access to git and not the github api.

@mattklein123
Copy link
Member

OK I made a bot user. I'm going to merge this and then do a test release.

@mattklein123 mattklein123 merged commit 19b57d8 into envoyproxy:master Mar 14, 2018
@taion809 taion809 deleted the feat-add-linux-binaries branch March 14, 2018 19:47
mattklein123 added a commit that referenced this pull request Mar 14, 2018
mattklein123 added a commit that referenced this pull request Mar 14, 2018
This reverts commit 19b57d8.

Signed-off-by: Matt Klein <mklein@lyft.com>
mattklein123 added a commit that referenced this pull request Mar 15, 2018
This reverts commit 19b57d8.
This reverts commit 1392066.

Signed-off-by: Matt Klein <mklein@lyft.com>
Shikugawa pushed a commit to Shikugawa/envoy that referenced this pull request Mar 28, 2020
* bump SHA

Signed-off-by: Kuat Yessenov <kuat@google.com>

* update workspace

Signed-off-by: Kuat Yessenov <kuat@google.com>

* no RBE

Signed-off-by: Kuat Yessenov <kuat@google.com>
jpsim pushed a commit that referenced this pull request Nov 28, 2022
Description: As a follow up for PR2568, the PR maps the network_disconnected and quic exception errors. The network_changed error has been removed as this is not relevant to envoymobile.

Signed-off-by: Chidera Olibie <colibie@google.com>
Signed-off-by: JP Simard <jp@jpsim.com>
jpsim pushed a commit that referenced this pull request Nov 29, 2022
Description: As a follow up for PR2568, the PR maps the network_disconnected and quic exception errors. The network_changed error has been removed as this is not relevant to envoymobile.

Signed-off-by: Chidera Olibie <colibie@google.com>
Signed-off-by: JP Simard <jp@jpsim.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Provide prebuilt static binaries for convenience

5 participants