Skip to content

Commit

Permalink
adjust impl.
Browse files Browse the repository at this point in the history
  • Loading branch information
AyodeAwe committed Sep 19, 2023
1 parent d5a0fd6 commit a6b8b8a
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 25 deletions.
1 change: 0 additions & 1 deletion .github/workflows/build-and-publish-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ jobs:
uses: ./.github/workflows/build-image.yml
with:
ARCHES: ${{ toJSON(matrix.ARCHES) }}
BUILD_TYPE: ${{ inputs.build_type }}
CUDA_VER: ${{ matrix.CUDA_VER }}
LINUX_VER: ${{ matrix.LINUX_VER }}
PYTHON_VER: ${{ matrix.PYTHON_VER }}
Expand Down
7 changes: 1 addition & 6 deletions .github/workflows/build-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@ on:
IMAGE_NAME:
required: true
type: string
build_type:
required: true
type: string

jobs:
run:
Expand Down Expand Up @@ -65,7 +62,6 @@ jobs:
run: ci/generate-tags.sh
env:
CURRENT_TAG: ${{ inputs.IMAGE_NAME }}-${{ matrix.ARCH }}
build_type: ${{ inputs.build_type}}
- name: Build image
uses: docker/build-push-action@v4
with:
Expand All @@ -75,5 +71,4 @@ jobs:
pull: true
build-args: |
${{ steps.generate-build-args.outputs.ARGS }}
tags: |
${{ steps.generate-additional-tag.outputs.TAGS }}
tags: ${{ steps.generate-additional-tag.outputs.TAG }}
File renamed without changes.
28 changes: 27 additions & 1 deletion ci/create-multiarch-manifest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
set -euo pipefail

PREFIX="conda"
if [[ "${IMAGE_REPO}" != "ci" ]]; then
if [[ "${IMAGE_REPO}" != "ci-conda" ]]; then
PREFIX="wheels"
fi

Expand Down Expand Up @@ -31,3 +31,29 @@ if [[
echo "Skipping 'latest' manifest creation for PR workflow."
fi
fi

# publish rapidsai/ci manifests too
if [[ $IMAGE_NAME =~ ci-conda ]]; then
IMAGE_NAME=$(echo "$IMAGE_NAME" | sed 's/ci-conda/ci/')
source_tags=()
tag="${IMAGE_NAME}"
for arch in $(echo "${ARCHES}" | jq .[] -r); do
source_tags+=("${tag}-${arch}")
done

docker manifest create "${tag}" "${source_tags[@]}"
docker manifest push "${tag}"
if [[
"${LATEST_UBUNTU_VER}" == "${LINUX_VER}" &&
"${LATEST_CUDA_VER}" == "${CUDA_VER}" &&
"${LATEST_PYTHON_VER}" == "${PYTHON_VER}"
]]; then
# only create a 'latest' manifest if it is a non-PR workflow.
if [[ "${BUILD_TYPE}" != "pull-request" ]]; then
docker manifest create "rapidsai/${IMAGE_REPO}:latest" "${source_tags[@]}"
docker manifest push "rapidsai/${IMAGE_REPO}:latest"
else
echo "Skipping 'latest' manifest creation for PR workflow."
fi
fi
fi
24 changes: 9 additions & 15 deletions ci/generate-tags.sh
Original file line number Diff line number Diff line change
@@ -1,18 +1,12 @@
#!/bin/bash
set -euo pipefail

prefix=$(echo "$CURRENT_TAG" | awk -F':' '{print $1}')
suffix=$(echo "$CURRENT_TAG" | awk -F':' '{print $2}')

if [ "$build_type" == "branch" ]; then
cat <<EOF > "${GITHUB_OUTPUT:-/dev/stdout}"
TAGS<<EOT
$(printf "%s\n" "${prefix}:${suffix}" "${prefix}-conda:${suffix}")
EOT
EOF
else
cat <<EOF > "${GITHUB_OUTPUT:-/dev/stdout}"
TAGS<<EOT
$(printf "%s\n" "$CURRENT_TAG")
EOT
EOF
if [[ ! "$CURRENT_TAG" =~ "ci-conda" ]]; then
echo "TAG=$CURRENT_TAG" > "$GITHUB_OUTPUT"
exit 0
fi

CI_TAG=$(echo "$CURRENT_TAG" | sed 's/ci-conda/ci/')

echo "TAG=$CURRENT_TAG,$CI_TAG" | tee --append "$GITHUB_OUTPUT"

14 changes: 14 additions & 0 deletions ci/remove-temp-images.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,17 @@ for arch in $(echo "$ARCHES" | jq .[] -r); do
-H "Authorization: JWT $HUB_TOKEN" \
"https://hub.docker.com/v2/repositories/$full_repo_name/tags/$tag-$arch/"
done

# delete rapidsai/ci imgs too
if [[ $IMAGE_NAME =~ ci-conda ]]; then
IMAGE_NAME=$(echo "$IMAGE_NAME" | sed 's/ci-conda/ci/')
full_repo_name=${IMAGE_NAME%%:*}
tag=${IMAGE_NAME##*:}

for arch in $(echo "$ARCHES" | jq .[] -r); do
curl --fail-with-body -i -X DELETE \
-H "Accept: application/json" \
-H "Authorization: JWT $HUB_TOKEN" \
"https://hub.docker.com/v2/repositories/$full_repo_name/tags/$tag-$arch/"
done
fi
4 changes: 2 additions & 2 deletions matrix.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ LINUX_VER:
- "centos7"
- "rockylinux8"
IMAGE_REPO:
- "ci"
- "ci-conda"
- "ci-wheel"
- "citestwheel"
exclude:
Expand Down Expand Up @@ -65,4 +65,4 @@ exclude:

# exclude ci for ubuntu18.04
- LINUX_VER: "ubuntu18.04"
IMAGE_REPO: "ci"
IMAGE_REPO: "ci-conda"

0 comments on commit a6b8b8a

Please sign in to comment.