From c9e5db1112477137c4e7e1967f35d9de6d387076 Mon Sep 17 00:00:00 2001 From: Keshav Date: Thu, 3 Dec 2020 10:59:58 +0000 Subject: [PATCH] Added 'docker login' to fix pull rate limit issue --- README.md | 12 ++++++++++++ test/integration/codebuild/buildspec.os.alpine.yml | 8 ++++++++ .../codebuild/buildspec.os.amazonlinux.yml | 8 ++++++++ test/integration/codebuild/buildspec.os.centos.yml | 8 ++++++++ test/integration/codebuild/buildspec.os.debian.yml | 8 ++++++++ test/integration/codebuild/buildspec.os.ubuntu.yml | 8 ++++++++ 6 files changed, 52 insertions(+) diff --git a/README.md b/README.md index 733eab9..bef284a 100644 --- a/README.md +++ b/README.md @@ -141,6 +141,18 @@ Then, * to run integration tests: `make test-integ` * to run smoke tests: `make test-smoke` +### Troubleshooting +While running integration tests, you might encounter the Docker Hub rate limit error with the following body: +``` +You have reached your pull rate limit. You may increase the limit by authenticating and upgrading: https://www.docker.com/increase-rate-limits +``` +To fix the above issue, consider authenticating to a Docker Hub account by setting the Docker Hub credentials as below CodeBuild environment variables. +```shell script +DOCKERHUB_USERNAME= +DOCKERHUB_PASSWORD= +``` +Recommended way is to set the Docker Hub credentials in CodeBuild job by retrieving them from AWS Secrets Manager. + ## Security If you discover a potential security issue in this project we ask that you notify AWS/Amazon Security via our [vulnerability reporting page](http://aws.amazon.com/security/vulnerability-reporting/). Please do **not** create a public github issue. diff --git a/test/integration/codebuild/buildspec.os.alpine.yml b/test/integration/codebuild/buildspec.os.alpine.yml index af1a09e..a2e7b89 100644 --- a/test/integration/codebuild/buildspec.os.alpine.yml +++ b/test/integration/codebuild/buildspec.os.alpine.yml @@ -39,6 +39,14 @@ phases: - > echo "COPY ${SCRATCH_DIR}/aws-lambda-rie /usr/bin/aws-lambda-rie" >> \ "${SCRATCH_DIR}/Dockerfile.echo.${OS_DISTRIBUTION}.tmp" + - > + if [[ -z "${DOCKERHUB_USERNAME}" && -z "${DOCKERHUB_PASSWORD}" ]]; + then + echo "DockerHub credentials not set as CodeBuild environment variables. Continuing without docker login." + else + echo "Performing DockerHub login . . ." + docker login -u $DOCKERHUB_USERNAME -p $DOCKERHUB_PASSWORD + fi - echo "Building image ${IMAGE_TAG}" - > docker build . \ diff --git a/test/integration/codebuild/buildspec.os.amazonlinux.yml b/test/integration/codebuild/buildspec.os.amazonlinux.yml index 9e89200..66d095a 100644 --- a/test/integration/codebuild/buildspec.os.amazonlinux.yml +++ b/test/integration/codebuild/buildspec.os.amazonlinux.yml @@ -35,6 +35,14 @@ phases: - > echo "COPY ${SCRATCH_DIR}/aws-lambda-rie /usr/bin/aws-lambda-rie" >> \ "${SCRATCH_DIR}/Dockerfile.echo.${OS_DISTRIBUTION}.tmp" + - > + if [[ -z "${DOCKERHUB_USERNAME}" && -z "${DOCKERHUB_PASSWORD}" ]]; + then + echo "DockerHub credentials not set as CodeBuild environment variables. Continuing without docker login." + else + echo "Performing DockerHub login . . ." + docker login -u $DOCKERHUB_USERNAME -p $DOCKERHUB_PASSWORD + fi - echo "Building image ${IMAGE_TAG}" - > docker build . \ diff --git a/test/integration/codebuild/buildspec.os.centos.yml b/test/integration/codebuild/buildspec.os.centos.yml index c277ca2..5932ea5 100644 --- a/test/integration/codebuild/buildspec.os.centos.yml +++ b/test/integration/codebuild/buildspec.os.centos.yml @@ -36,6 +36,14 @@ phases: - > echo "COPY ${SCRATCH_DIR}/aws-lambda-rie /usr/bin/aws-lambda-rie" >> \ "${SCRATCH_DIR}/Dockerfile.echo.${OS_DISTRIBUTION}.tmp" + - > + if [[ -z "${DOCKERHUB_USERNAME}" && -z "${DOCKERHUB_PASSWORD}" ]]; + then + echo "DockerHub credentials not set as CodeBuild environment variables. Continuing without docker login." + else + echo "Performing DockerHub login . . ." + docker login -u $DOCKERHUB_USERNAME -p $DOCKERHUB_PASSWORD + fi - echo "Building image ${IMAGE_TAG}" - > docker build . \ diff --git a/test/integration/codebuild/buildspec.os.debian.yml b/test/integration/codebuild/buildspec.os.debian.yml index d99c8c7..b1e5b13 100644 --- a/test/integration/codebuild/buildspec.os.debian.yml +++ b/test/integration/codebuild/buildspec.os.debian.yml @@ -35,6 +35,14 @@ phases: - > echo "COPY ${SCRATCH_DIR}/aws-lambda-rie /usr/bin/aws-lambda-rie" >> \ "${SCRATCH_DIR}/Dockerfile.echo.${OS_DISTRIBUTION}.tmp" + - > + if [[ -z "${DOCKERHUB_USERNAME}" && -z "${DOCKERHUB_PASSWORD}" ]]; + then + echo "DockerHub credentials not set as CodeBuild environment variables. Continuing without docker login." + else + echo "Performing DockerHub login . . ." + docker login -u $DOCKERHUB_USERNAME -p $DOCKERHUB_PASSWORD + fi - echo "Building image ${IMAGE_TAG}" - > docker build . \ diff --git a/test/integration/codebuild/buildspec.os.ubuntu.yml b/test/integration/codebuild/buildspec.os.ubuntu.yml index 684b444..782161f 100644 --- a/test/integration/codebuild/buildspec.os.ubuntu.yml +++ b/test/integration/codebuild/buildspec.os.ubuntu.yml @@ -39,6 +39,14 @@ phases: - > echo "COPY ${SCRATCH_DIR}/aws-lambda-rie /usr/bin/aws-lambda-rie" >> \ "${SCRATCH_DIR}/Dockerfile.echo.${OS_DISTRIBUTION}.tmp" + - > + if [[ -z "${DOCKERHUB_USERNAME}" && -z "${DOCKERHUB_PASSWORD}" ]]; + then + echo "DockerHub credentials not set as CodeBuild environment variables. Continuing without docker login." + else + echo "Performing DockerHub login . . ." + docker login -u $DOCKERHUB_USERNAME -p $DOCKERHUB_PASSWORD + fi - echo "Building image ${IMAGE_TAG}" - > docker build . \