-
Notifications
You must be signed in to change notification settings - Fork 225
Setup binary release CI pipeline #1085
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
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
666b58a
Add dockerfile for xgo building
bowd 5bc44a6
Add archive script and prepare for cloudbuild ci run
bowd a0b0121
Modify cloudbuild to execute inline bash (maybe)
bowd 5c4b5b4
Add cache-from to speedup build
bowd 25237dd
Change the release whitelist logic
bowd ba9610b
Fix missing TAG_NAME issue
bowd cc26b1e
Add pull before build to use cache-from
bowd 8aafe98
Modify logic to slim down the xgo builder image
bowd 1b1145c
Remove deprecated step
bowd add7cac
Fix archive content
bowd a4142e6
Add explanation to dockerfile
bowd File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| # Purpose: | ||
| # ------- | ||
| # This docker image is used by the ./cloudbuild-binaries.yaml CI flow to | ||
| # cross-compile geth for different platforms. | ||
| # At the time of writing this is only linux-{386/amd64} but there are two | ||
| # pending update that will add darwin-{386,amd64} and windows-amd64 support. | ||
| # | ||
| # How to test changes to this image locally: | ||
| # ----------------------------------------- | ||
| # First build the image: | ||
| # docker build -f Dockerfile.binaries -t gcr.io/celo-testnet/geth-xgo-builder:$USER . | ||
| # | ||
| # Running this image depends on a series of environment variables: | ||
| # BUILD_TARGETS Comma separated list of platforms to build for, | ||
| # passed as an arg to xgo. eg: "linux/386,linux/amd64" | ||
| # TAG_NAME Name of the tag associated with the current commit | ||
| # BRANCH_NAME Name of the branch | ||
| # REPO_NAME Name of the repo | ||
| # COMMIT_SHA Full SHA of the commit | ||
| # COMMIT_TIMESTAMP Commit timestamp | ||
| # TODO: currently this is not accurately passed see | ||
| # discussion in PR celo-blockchain#<number> | ||
|
bowd marked this conversation as resolved.
|
||
| # CLOUDBUILD True/False | ||
| # CI True/False | ||
| # These two are used to comply with how geth handles build | ||
| # environments internal/build/env.go where we have added a | ||
| # branch for Cloudbuild | ||
| # You also need to mount: | ||
| # $(pwd)/build/bin:/build - where binaries will be written | ||
| # $(pwd)/build/archives:/archives - where the archives (final release artfeact) will be written | ||
| # $(pwd):/go/src/github.com/ethereum/go-ethereum - the source code | ||
| # | ||
| # With all of the above in place the container needs to execute two commands: | ||
| # (see ./cloudbuild-binaries.yaml for example of the full command) | ||
| # 1. Create the binaries: | ||
| # go run build/ci.go xgo --alltools -- -targets=$BUILD_TARGETS -v -dest /build | ||
| # 2. Create release archives: | ||
| # go run build/ci.go xgo-archive -targets=$_BUILD_TARGETS -in /build -out /archives | ||
| # | ||
| # This will result in build archives stored in ./build/archives | ||
| # In the CI flow these are then uploaded to cloud storage as artefacts. | ||
|
|
||
| # Build Geth binaries in the xgo builder container | ||
| FROM techknowlogick/xgo:go-1.13.x | ||
| # techknowlogic/xgo is a fork of karalabe/xgo updated to ubunut-18, it is more maintained | ||
| # by the community and allows us to backport mingw in order to build for windows | ||
| # See discussion in PR celo-blockchain#<number> about downsides of this image | ||
|
bowd marked this conversation as resolved.
|
||
|
|
||
| # We need a newer version of mingw, backported to Bionic | ||
| ENV DEBIAN_FRONTEND=noninteractive | ||
| RUN apt update && apt install -y --no-install-recommends software-properties-common apt-utils | ||
| RUN add-apt-repository -y ppa:mati865/mingw-w64 | ||
| RUN apt update && apt -y upgrade | ||
|
|
||
| RUN mkdir -p /go/src/github.com/ethereum/go-ethereum | ||
| WORKDIR /go/src/github.com/ethereum/go-ethereum | ||
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,62 @@ | ||
| # See ./Dockerfile.binaries for more information w.r.t this CI flow | ||
| steps: | ||
| - name: 'gcr.io/cloud-builders/docker' | ||
| entrypoint: 'sh' | ||
| args: | ||
| - '-c' | ||
| - 'docker pull us.gcr.io/$PROJECT_ID/geth-xgo-builder:latest || exit 0' | ||
| - name: 'gcr.io/cloud-builders/docker' | ||
| entrypoint: 'sh' | ||
| args: | ||
| - '-c' | ||
| - 'docker build . | ||
| --cache-from us.gcr.io/$PROJECT_ID/geth-xgo-builder:latest | ||
| -t us.gcr.io/$PROJECT_ID/geth-xgo-builder:$COMMIT_SHA | ||
| -t us.gcr.io/$PROJECT_ID/geth-xgo-builder:latest | ||
| -f Dockerfile.binaries' | ||
| - name: 'gcr.io/cloud-builders/docker' | ||
| entrypoint: 'sh' | ||
| args: | ||
| - '-c' | ||
| - 'docker run --rm | ||
| -v $(pwd)/build/bin:/build | ||
| -v $(pwd)/build/archives:/archives | ||
| -v $(pwd):/go/src/github.com/ethereum/go-ethereum | ||
| --entrypoint /bin/sh | ||
| --env BUILD_TARGETS=$_BUILD_TARGETS | ||
| --env TAG_NAME=$TAG_NAME | ||
| --env BRANCH_NAME=$BRANCH_NAME | ||
| --env REPO_NAME=$REPO_NAME | ||
| --env COMMIT_SHA=$COMMIT_SHA | ||
| --env COMMIT_TIMESTAMP=$(date +%s) | ||
| --env CLOUDBUILD=True | ||
| --env CI=True | ||
| us.gcr.io/$PROJECT_ID/geth-xgo-builder:$COMMIT_SHA | ||
| -c "go run build/ci.go xgo --alltools -- -targets=$_BUILD_TARGETS -v -dest /build"' | ||
| - name: 'gcr.io/cloud-builders/docker' | ||
| entrypoint: 'sh' | ||
| args: | ||
| - '-c' | ||
| - 'docker run --rm | ||
| -v $(pwd)/build/bin:/build | ||
| -v $(pwd)/build/archives:/archives | ||
| -v $(pwd):/go/src/github.com/ethereum/go-ethereum | ||
| --entrypoint /bin/sh | ||
| --env BUILD_TARGETS=$_BUILD_TARGETS | ||
| --env TAG_NAME=$TAG_NAME | ||
| --env BRANCH_NAME=$BRANCH_NAME | ||
| --env REPO_NAME=$REPO_NAME | ||
| --env COMMIT_SHA=$COMMIT_SHA | ||
| --env COMMIT_TIMESTAMP=$(date +%s) | ||
| --env CLOUDBUILD=True | ||
| --env CI=True | ||
| us.gcr.io/$PROJECT_ID/geth-xgo-builder:$COMMIT_SHA | ||
| -c "go run build/ci.go xgo-archive -targets=$_BUILD_TARGETS -in /build -out /archives"' | ||
| artifacts: | ||
| objects: | ||
| location: 'gs://$_BUCKET/$BRANCH_NAME/' | ||
| paths: ['./build/archives/*'] | ||
| images: | ||
| - 'us.gcr.io/$PROJECT_ID/geth-xgo-builder:$COMMIT_SHA' | ||
| - 'us.gcr.io/$PROJECT_ID/geth-xgo-builder:latest' | ||
| timeout: 2700s |
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
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.