From 999413d224fd336b84e55b7d32260762ebd432a4 Mon Sep 17 00:00:00 2001 From: Lucas Gravley <29484535+admiralAwkbar@users.noreply.github.com> Date: Thu, 13 Aug 2020 12:40:21 -0500 Subject: [PATCH 1/5] adding more tests and cool logic --- .automation/test/docker/good/Dockerfile.dev | 13 +++++++++++++ lib/buildFileList.sh | 6 ++++-- 2 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 .automation/test/docker/good/Dockerfile.dev diff --git a/.automation/test/docker/good/Dockerfile.dev b/.automation/test/docker/good/Dockerfile.dev new file mode 100644 index 00000000..33ed48d0 --- /dev/null +++ b/.automation/test/docker/good/Dockerfile.dev @@ -0,0 +1,13 @@ +FROM node:10 + +# Create app directory +RUN mkdir -p /usr/src/app +WORKDIR /usr/src/app + +# Install app dependencies +COPY package.json /usr/src/app/ +RUN npm install + +COPY server.js server.js +EXPOSE 3000 +CMD ["node", "server.js"] diff --git a/lib/buildFileList.sh b/lib/buildFileList.sh index ce85dedd..681e253f 100755 --- a/lib/buildFileList.sh +++ b/lib/buildFileList.sh @@ -79,11 +79,13 @@ function BuildFileList() { FILE_TYPE=${FILE##*.} # To lowercase FILE_TYPE=${FILE_TYPE,,} + # get the baseFile for additonal logic + BASE_FILE=$(basename "${FILE,,}") ############## # Print file # ############## - info "File:[${FILE}], File_type:[${FILE_TYPE}]" + info "File:[${FILE}], File_type:[${FILE_TYPE}], Base_file:[${BASE_FILE}]" ######### # DEBUG # @@ -432,7 +434,7 @@ function BuildFileList() { # Set the READ_ONLY_CHANGE_FLAG since this could be exec # ########################################################## READ_ONLY_CHANGE_FLAG=1 - elif [ "${FILE}" == "dockerfile" ] || [ "${FILE_TYPE}" == "dockerfile" ]; then + elif [ "${FILE_TYPE}" == "dockerfile" ] [ "${BASE_FILE}" == *"dockerfile."* ] ||; then ################################ # Append the file to the array # ################################ From c7f28b9b7fe9798268d7febe4c3ca23cdd7de4f8 Mon Sep 17 00:00:00 2001 From: Lucas Gravley <29484535+admiralAwkbar@users.noreply.github.com> Date: Thu, 13 Aug 2020 12:44:55 -0500 Subject: [PATCH 2/5] backwards --- lib/buildFileList.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/buildFileList.sh b/lib/buildFileList.sh index 681e253f..49c35ba5 100755 --- a/lib/buildFileList.sh +++ b/lib/buildFileList.sh @@ -434,7 +434,7 @@ function BuildFileList() { # Set the READ_ONLY_CHANGE_FLAG since this could be exec # ########################################################## READ_ONLY_CHANGE_FLAG=1 - elif [ "${FILE_TYPE}" == "dockerfile" ] [ "${BASE_FILE}" == *"dockerfile."* ] ||; then + elif [ "${FILE_TYPE}" == "dockerfile" ] || [ "${BASE_FILE}" == *"dockerfile."* ]; then ################################ # Append the file to the array # ################################ From 0d3547c35b968b618aff7684200b1c8e73e68ede Mon Sep 17 00:00:00 2001 From: Lucas Gravley <29484535+admiralAwkbar@users.noreply.github.com> Date: Thu, 13 Aug 2020 12:48:00 -0500 Subject: [PATCH 3/5] more quotes --- lib/buildFileList.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/buildFileList.sh b/lib/buildFileList.sh index 49c35ba5..e565868d 100755 --- a/lib/buildFileList.sh +++ b/lib/buildFileList.sh @@ -434,7 +434,7 @@ function BuildFileList() { # Set the READ_ONLY_CHANGE_FLAG since this could be exec # ########################################################## READ_ONLY_CHANGE_FLAG=1 - elif [ "${FILE_TYPE}" == "dockerfile" ] || [ "${BASE_FILE}" == *"dockerfile."* ]; then + elif [ "${FILE_TYPE}" == "dockerfile" ] || [[ "${BASE_FILE}" == *"dockerfile."* ]]; then ################################ # Append the file to the array # ################################ From 66f29cc7e78595e6fe61d5cb0ac405f0e01e6060 Mon Sep 17 00:00:00 2001 From: Lucas Gravley <29484535+admiralAwkbar@users.noreply.github.com> Date: Thu, 13 Aug 2020 12:58:30 -0500 Subject: [PATCH 4/5] adding retries for common failures --- Dockerfile | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/Dockerfile b/Dockerfile index c9d057a2..2adf70cd 100644 --- a/Dockerfile +++ b/Dockerfile @@ -104,13 +104,13 @@ RUN bundle install ############################## # Installs Perl dependencies # ############################## -RUN curl -sL https://cpanmin.us/ | perl - -nq --no-wget Perl::Critic +RUN curl --retry 5 --retry-delay 5 -sL https://cpanmin.us/ | perl - -nq --no-wget Perl::Critic ############################## # Install Phive dependencies # ############################## -RUN wget -O phive.phar https://phar.io/releases/phive.phar \ - && wget -O phive.phar.asc https://phar.io/releases/phive.phar.asc \ +RUN wget --tries=5 -O phive.phar https://phar.io/releases/phive.phar \ + && wget--tries=5 -O phive.phar.asc https://phar.io/releases/phive.phar.asc \ && gpg --keyserver pool.sks-keyservers.net --recv-keys 0x9D8A98B29B2D5D79 \ && gpg --verify phive.phar.asc phive.phar \ && chmod +x phive.phar \ @@ -126,7 +126,7 @@ RUN wget -O phive.phar https://phar.io/releases/phive.phar \ # Slightly modified to always retrieve latest stable Powershell version # If changing PWSH_VERSION='latest' to a specific version, use format PWSH_VERSION='tags/v7.0.2' RUN mkdir -p ${PWSH_DIRECTORY} \ - && curl -s https://api.github.com/repos/powershell/powershell/releases/${PWSH_VERSION} \ + && curl --retry 5 --retry-delay 5 -s https://api.github.com/repos/powershell/powershell/releases/${PWSH_VERSION} \ | grep browser_download_url \ | grep linux-alpine-x64 \ | cut -d '"' -f 4 \ @@ -142,7 +142,7 @@ RUN mkdir -p ${PWSH_DIRECTORY} \ # Reference https://github.com/Azure/arm-ttk # Reference https://docs.microsoft.com/en-us/azure/azure-resource-manager/templates/test-toolkit ENV ARM_TTK_PSD1="${ARM_TTK_DIRECTORY}/arm-ttk-master/arm-ttk/arm-ttk.psd1" -RUN curl -sLO "${ARM_TTK_URI}" \ +RUN curl --retry 5 --retry-delay 5 -sLO "${ARM_TTK_URI}" \ && unzip "${ARM_TTK_NAME}" -d "${ARM_TTK_DIRECTORY}" \ && rm "${ARM_TTK_NAME}" \ && ln -sTf "${ARM_TTK_PSD1}" /usr/bin/arm-ttk @@ -190,16 +190,16 @@ COPY --from=dockerfile-lint /bin/hadolint /usr/bin/hadolint ################## # Install ktlint # ################## -RUN curl -sSLO https://github.com/pinterest/ktlint/releases/latest/download/ktlint && chmod a+x ktlint \ +RUN curl --retry 5 --retry-delay 5 -sSLO https://github.com/pinterest/ktlint/releases/latest/download/ktlint && chmod a+x ktlint \ && mv "ktlint" /usr/bin/ #################### # Install dart-sdk # #################### -RUN wget -q -O /etc/apk/keys/sgerrand.rsa.pub https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub -RUN wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/${GLIBC_VERSION}/glibc-${GLIBC_VERSION}.apk +RUN wget --tries=5 -q -O /etc/apk/keys/sgerrand.rsa.pub https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub +RUN wget --tries=5 https://github.com/sgerrand/alpine-pkg-glibc/releases/download/${GLIBC_VERSION}/glibc-${GLIBC_VERSION}.apk RUN apk add --no-cache glibc-${GLIBC_VERSION}.apk && rm glibc-${GLIBC_VERSION}.apk -RUN wget https://storage.googleapis.com/dart-archive/channels/stable/release/${DART_VERSION}/sdk/dartsdk-linux-x64-release.zip -O - -q | unzip -q - \ +RUN wget --tries=5 https://storage.googleapis.com/dart-archive/channels/stable/release/${DART_VERSION}/sdk/dartsdk-linux-x64-release.zip -O - -q | unzip -q - \ && chmod +x dart-sdk/bin/dart* \ && mv dart-sdk/bin/* /usr/bin/ && mv dart-sdk/lib/* /usr/lib/ && mv dart-sdk/include/* /usr/include/ \ && rm -r dart-sdk/ @@ -219,19 +219,19 @@ RUN CHECKSTYLE_LATEST=$(curl -s https://api.github.com/repos/checkstyle/checksty | grep browser_download_url \ | grep ".jar" \ | cut -d '"' -f 4) \ - && curl -sSL $CHECKSTYLE_LATEST \ + && curl --retry 5 --retry-delay 5 -sSL $CHECKSTYLE_LATEST \ --output /usr/bin/checkstyle #################### # Install luacheck # #################### -RUN wget https://www.lua.org/ftp/lua-5.3.5.tar.gz -O - -q | tar -xzf - \ +RUN wget --tries=5 https://www.lua.org/ftp/lua-5.3.5.tar.gz -O - -q | tar -xzf - \ && cd lua-5.3.5 \ && make linux \ && make install \ && cd .. && rm -r lua-5.3.5/ -RUN wget https://github.com/cvega/luarocks/archive/v3.3.1-super-linter.tar.gz -O - -q | tar -xzf - \ +RUN wget --tries=5 https://github.com/cvega/luarocks/archive/v3.3.1-super-linter.tar.gz -O - -q | tar -xzf - \ && cd luarocks-3.3.1-super-linter \ && ./configure --with-lua-include=/usr/local/include \ && make \ From f155bf770c62564e6f7ddfca25bb06b5ea671b10 Mon Sep 17 00:00:00 2001 From: Lucas Gravley <29484535+admiralAwkbar@users.noreply.github.com> Date: Thu, 13 Aug 2020 13:06:24 -0500 Subject: [PATCH 5/5] spaces --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 2adf70cd..f94da294 100644 --- a/Dockerfile +++ b/Dockerfile @@ -110,7 +110,7 @@ RUN curl --retry 5 --retry-delay 5 -sL https://cpanmin.us/ | perl - -nq --no-wge # Install Phive dependencies # ############################## RUN wget --tries=5 -O phive.phar https://phar.io/releases/phive.phar \ - && wget--tries=5 -O phive.phar.asc https://phar.io/releases/phive.phar.asc \ + && wget --tries=5 -O phive.phar.asc https://phar.io/releases/phive.phar.asc \ && gpg --keyserver pool.sks-keyservers.net --recv-keys 0x9D8A98B29B2D5D79 \ && gpg --verify phive.phar.asc phive.phar \ && chmod +x phive.phar \