diff --git a/Dockerfile b/Dockerfile index d954f9f..b19dc1b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -15,7 +15,7 @@ RUN apt-get update \ # Install Danger-JS(Danger-Swift depends) ARG DANGER_JS_REVISION=master ENV DANGER_JS_REVISION=${DANGER_JS_REVISION} -RUN npm install -g danger \ +RUN npm install -g danger | tee /var/log/danger-js-build.log \ && danger-js --version > /.danger-js_revision # Install Danger-Swift @@ -26,13 +26,13 @@ ENV DANGER_SWIFT_REVISION=${DANGER_SWIFT_REVISION} RUN git clone --depth=1 -b ${DANGER_SWIFT_REVISION} https://github.com/danger/danger-swift.git ~/danger-swift \ && git -C ~/danger-swift rev-parse HEAD > /.danger-swift_revision \ && sed -i -e 's/let isDevelop = true/let isDevelop = false/g' ~/danger-swift/Package.swift \ - && make -C ~/danger-swift install \ + && make -C ~/danger-swift install | tee /var/log/danger-swift-build.log \ && rm -rf ~/danger-swift # Install SwiftLint ARG SWIFT_LINT_REVISION=main ENV SWIFT_LINT_REVISION=${SWIFT_LINT_REVISION} -RUN mint install realm/SwiftLint@${SWIFT_LINT_REVISION} \ +RUN mint install realm/SwiftLint@${SWIFT_LINT_REVISION} | tee /var/log/swiftlint-build.log \ && swiftlint --version > /.swiftlint_revision ADD entrypoint.sh /usr/local/bin/entrypoint diff --git a/scripts/build_and_push_arm64_image.sh b/scripts/build_and_push_arm64_image.sh index f97d80c..336f10a 100755 --- a/scripts/build_and_push_arm64_image.sh +++ b/scripts/build_and_push_arm64_image.sh @@ -69,24 +69,29 @@ for version in $(echo "$MATRIX_JSON" | jq -r '.swift_version[]'); do swiftlint_version=$(echo "$MATRIX_JSON" | jq -r ".swiftlint_supported_version[\"$version\"]") docker build --build-arg SWIFT_VERSION=$version --build-arg SWIFT_LINT_REVISION=$swiftlint_version -t "$DOCKER_USER/$IMAGE_NAME:$version-arm64" -f "$REPO_ROOT/Dockerfile" "$REPO_ROOT" if [[ $? -eq 0 ]]; then - docker push "$DOCKER_USER/$IMAGE_NAME:$version-arm64" - echo "\e[32mBuilding arm64 image finished!\e[m" + docker run --rm --entrypoint show-versions -t "$DOCKER_USER/$IMAGE_NAME:$version-arm64" + if [[ $? -eq 0 ]]; then + docker push "$DOCKER_USER/$IMAGE_NAME:$version-arm64" + echo "\e[32mBuilding arm64 image finished!\e[m" - # Create manifest - echo "\e[32mCreating manifest started...\e[m" - docker manifest create "$DOCKER_USER/$IMAGE_NAME:$version" \ - --amend "$DOCKER_USER/$IMAGE_NAME:$version-amd64" \ - --amend "$DOCKER_USER/$IMAGE_NAME:$version-arm64" - docker manifest push "$DOCKER_USER/$IMAGE_NAME:$version" - echo "\e[32mCreating manifest finished!\e[m" - - # Create latest manifest - if [[ "$version" == "$LATEST_VERSION" ]]; then - echo "\e[32mCreating latest manifest...\e[m" - docker manifest create "$DOCKER_USER/${IMAGE_NAME}:latest" \ + # Create manifest + echo "\e[32mCreating manifest started...\e[m" + docker manifest create "$DOCKER_USER/$IMAGE_NAME:$version" \ --amend "$DOCKER_USER/$IMAGE_NAME:$version-amd64" \ --amend "$DOCKER_USER/$IMAGE_NAME:$version-arm64" - docker manifest push "$DOCKER_USER/${IMAGE_NAME}:latest" + docker manifest push "$DOCKER_USER/$IMAGE_NAME:$version" + echo "\e[32mCreating manifest finished!\e[m" + + # Create latest manifest + if [[ "$version" == "$LATEST_VERSION" ]]; then + echo "\e[32mCreating latest manifest...\e[m" + docker manifest create "$DOCKER_USER/${IMAGE_NAME}:latest" \ + --amend "$DOCKER_USER/$IMAGE_NAME:$version-amd64" \ + --amend "$DOCKER_USER/$IMAGE_NAME:$version-arm64" + docker manifest push "$DOCKER_USER/${IMAGE_NAME}:latest" + fi + else + echo "\e[31mBuilt arm64 image for $version is not expected.\e[m" fi else echo "\e[31mBuilding arm64 image for $version failed!\e[m" diff --git a/versions.sh b/versions.sh index 9879c92..35c7141 100755 --- a/versions.sh +++ b/versions.sh @@ -1,6 +1,16 @@ #!/bin/sh swift --version | grep 'Swift version' -echo "SwiftLint version $(swiftlint version)" -echo "danger-js version $(danger --version)" -echo "danger-swift version $(danger-swift --version)" +EXIT_CODE=$? +SWIFTLINT_VERSION=$(swiftlint version) +EXIT_CODE=$((EXIT_CODE|$?)) +DANGER_JS_VERSION=$(danger --version) +EXIT_CODE=$((EXIT_CODE|$?)) +DANGER_SWIFT_VERSION=$(danger-swift --version) +EXIT_CODE=$((EXIT_CODE|$?)) + +echo "SwiftLint version ${SWIFTLINT_VERSION}" +echo "danger-js version ${DANGER_JS_VERSION}" +echo "danger-swift version ${DANGER_SWIFT_VERSION}" + +exit $EXIT_CODE