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

Fix image verifying #53

Merged
merged 3 commits into from
Sep 19, 2023
Merged
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
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
35 changes: 20 additions & 15 deletions scripts/build_and_push_arm64_image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
16 changes: 13 additions & 3 deletions versions.sh
Original file line number Diff line number Diff line change
@@ -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