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

Add GITHUB_TOKEN to allow go get from private repos #28

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ If you just want to compile your application without packaging it in a Docker im
* LDFLAGS - flags to pass to the linker (defaults to '-s')
* COMPRESS_BINARY - if set to true, will use UPX to compress the final binary (defaults to false)
* OUTPUT - if set, will use the `-o` option with `go build` to output the final binary to the value of this env var
* GITHUB_TOKEN - if set, will use "https://${GITHUB_TOKEN}:[email protected]/" to download dependencies from github. Allowing access to private repos.

The above are environment variables to be passed to the docker run command:

Expand All @@ -120,6 +121,7 @@ The above are environment variables to be passed to the docker run command:
-e LDFLAGS='-extldflags "-static"' \
-e COMPRESS_BINARY=true \
-e OUTPUT=/bin/my_go_binary \
-e GITHUB_TOKEN=my_github_auth_token \
-v $(pwd):/src \
centurylink/golang-builder

Expand Down
5 changes: 5 additions & 0 deletions builder-cross/build_environment.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ mkdir -p "$(dirname "$pkgPath")"
# Link source dir into GOPATH
ln -sf /src "$pkgPath"

# If a github token is present use that..
if [ "${GITHUB_TOKEN}" != "" ]; then
git config --global url."https://${GITHUB_TOKEN}:[email protected]/".insteadOf "https://github.com/"
fi

if [ -e "$pkgPath/vendor" ];
then
# Enable vendor experiment
Expand Down
5 changes: 5 additions & 0 deletions builder/build_environment.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ mkdir -p "$(dirname "$pkgPath")"
# Link source dir into GOPATH
ln -sf /src "$pkgPath"

# If a github token is present use that..
if [ "${GITHUB_TOKEN}" != "" ]; then
git config --global url."https://${GITHUB_TOKEN}:[email protected]/".insteadOf "https://github.com/"
fi

if [ -e "$pkgPath/vendor" ];
then
# Enable vendor experiment
Expand Down
5 changes: 5 additions & 0 deletions tester/build_environment.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ mkdir -p "$(dirname "$pkgPath")"
# Link source dir into GOPATH
ln -sf /src "$pkgPath"

# If a github token is present use that..
if [ "${GITHUB_TOKEN}" != "" ]; then
git config --global url."https://${GITHUB_TOKEN}:[email protected]/".insteadOf "https://github.com/"
fi

if [ -e "$pkgPath/vendor" ];
then
# Enable vendor experiment
Expand Down