Skip to content

Commit

Permalink
fallback to go proxy for go mod download issues
Browse files Browse the repository at this point in the history
  • Loading branch information
brycahta committed Aug 15, 2022
1 parent 2e422d0 commit 184e939
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 14 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ docker-push:
docker push ${IMG_W_TAG}

build-docker-images:
${MAKEFILE_PATH}/scripts/build-docker-images -d -p ${SUPPORTED_PLATFORMS} -r ${IMG} -v ${VERSION}
${MAKEFILE_PATH}/scripts/build-docker-images -p ${SUPPORTED_PLATFORMS} -r ${IMG} -v ${VERSION}

push-docker-images:
@docker login -u ${DOCKERHUB_USERNAME} -p="${DOCKERHUB_TOKEN}"
Expand Down Expand Up @@ -74,7 +74,7 @@ readme-codeblock-test:


build-binaries:
${MAKEFILE_PATH}/scripts/build-binaries -d -p ${SUPPORTED_PLATFORMS} -v ${VERSION}
${MAKEFILE_PATH}/scripts/build-binaries -p ${SUPPORTED_PLATFORMS} -v ${VERSION}

## requires a github token
upload-resources-to-github:
Expand Down
7 changes: 1 addition & 6 deletions scripts/build-binaries
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ mkdir -p "${BIN_DIR}"

VERSION=$(make -s -f ${MAKE_FILE_PATH} version)
PLATFORMS=("linux/amd64")
PASS_THRU_ARGS=""

USAGE=$(cat << 'EOM'
Usage: build-binaries [-p <platform pairs>]
Expand All @@ -19,7 +18,6 @@ USAGE=$(cat << 'EOM'
Example: build-binaries -p "linux/amd64,linux/arm"
Optional:
-p Platform pair list (os/architecture) [DEFAULT: linux/amd64]
-d DIRECT: Set GOPROXY=direct to bypass go proxies
-v VERSION: The application version of the docker image [DEFAULT: output of `make version`]
EOM
)
Expand All @@ -30,9 +28,6 @@ while getopts "dp:v:" opt; do
p ) # Platform Pairs
IFS=',' read -ra PLATFORMS <<< "$OPTARG"
;;
d ) # sets GOPROXY=direct
PASS_THRU_ARGS="$PASS_THRU_ARGS -d"
;;
v ) # Image Version
VERSION="$OPTARG"
;;
Expand All @@ -52,7 +47,7 @@ for os_arch in "${PLATFORMS[@]}"; do
bin_name="${base_bin_name}-${os}-${arch}"

docker container rm $container_name || :
$SCRIPTPATH/build-docker-images -p $os_arch -v $VERSION -r $repo_name $PASS_THRU_ARGS
$SCRIPTPATH/build-docker-images -p $os_arch -v $VERSION -r $repo_name
docker container create --rm --name $container_name "$repo_name:$VERSION-$os-$arch"
docker container cp $container_name:/ec2-instance-selector $BIN_DIR/$bin_name

Expand Down
7 changes: 2 additions & 5 deletions scripts/build-docker-images
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ MAKE_FILE_PATH=$REPO_ROOT_PATH/Makefile

VERSION=$(make -s -f $MAKE_FILE_PATH version)
PLATFORMS=("linux/amd64")
GOPROXY="https://proxy.golang.org,direct"
GOPROXY="direct|https://proxy.golang.org"


USAGE=$(cat << 'EOM'
Expand All @@ -18,7 +18,6 @@ USAGE=$(cat << 'EOM'
Example: build-docker-images -p "linux/amd64,linux/arm"
Optional:
-p Platform pair list (os/architecture) [DEFAULT: linux/amd64]
-d DIRECT: Set GOPROXY=direct to bypass go proxies
-r IMAGE REPO: set the docker image repo
-v VERSION: The application version of the docker image [DEFAULT: output of `make version`]
EOM
Expand All @@ -30,9 +29,6 @@ while getopts "dp:r:v:" opt; do
p ) # Platform Pairs
IFS=',' read -ra PLATFORMS <<< "$OPTARG"
;;
d ) # GOPROXY=direct
GOPROXY="direct"
;;
r ) # Image Repo
IMAGE_REPO="$OPTARG"
;;
Expand All @@ -55,6 +51,7 @@ for os_arch in "${PLATFORMS[@]}"; do
docker build \
--build-arg GOOS=${os} \
--build-arg GOARCH=${arch} \
--build-arg GOPROXY=${GOPROXY} \
-t ${img_tag} \
${REPO_ROOT_PATH}
done
3 changes: 2 additions & 1 deletion test/license-test/run-license-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ BUILD_BIN="$BUILD_PATH/bin"
BINARY_NAME="ec2-instance-selector-linux-amd64"
LICENSE_TEST_TAG="aeis-license-test"
LICENSE_REPORT_FILE="$BUILD_PATH/license-report"
GOPROXY="direct|https://proxy.golang.org"

SUPPORTED_PLATFORMS_LINUX="linux/amd64" make -s -f $SCRIPTPATH/../../Makefile build-binaries
docker buildx build --load -t $LICENSE_TEST_TAG $SCRIPTPATH/
docker buildx build --load --build-arg=GOPROXY=${GOPROXY} -t $LICENSE_TEST_TAG $SCRIPTPATH/
docker run -i -e GITHUB_TOKEN --rm -v $SCRIPTPATH/:/test -v $BUILD_BIN/:/aeis-bin $LICENSE_TEST_TAG golicense /test/license-config.hcl /aeis-bin/$BINARY_NAME | tee $LICENSE_REPORT_FILE
$SCRIPTPATH/check-licenses.sh $LICENSE_REPORT_FILE

0 comments on commit 184e939

Please sign in to comment.