Skip to content

Commit

Permalink
[CI] Interleave image creation and push to relieve rate limiting from…
Browse files Browse the repository at this point in the history
… gcr.
  • Loading branch information
corneil committed Sep 14, 2023
1 parent f875c7a commit e36af67
Show file tree
Hide file tree
Showing 5 changed files with 75 additions and 76 deletions.
11 changes: 1 addition & 10 deletions .github/actions/build-images/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,7 @@ runs:
env:
TAG: ${{ inputs.version }}
shell: bash
run: .github/actions/build-images/pack-images.sh

# push images
- name: Push images
env:
TAG: ${{ inputs.version }}
shell: bash
run: |
export DEFAULT_JDK=11
.github/actions/build-images/push-images.sh
run: ${{ github.action_path }}/build-images.sh

# build/publish support images
- name: Publish Grafana Prometheus
Expand Down
70 changes: 70 additions & 0 deletions .github/actions/build-images/build-images.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
#!/usr/bin/env bash
if [ "$TAG" == "" ]; then
echo "TAG not found"
exit 1
fi
if [ "$DEFAULT_JDK" = "" ]; then
echo "DEFAULT_JDK not found using 11"
DEFAULT_JDK=11
else
echo "DEFAULT_JDK=$DEFAULT_JDK"
fi

function pack_image {
JAR="$1-$TAG.jar"
REPO="$2"
v="$3"
if [ ! -f "$JAR" ]; then
echo "File not found $JAR"
exit 2
fi
echo "Creating: $REPO:$TAG-jdk$v"
pack build --builder gcr.io/paketo-buildpacks/builder:base \
--path "$JAR" \
--env BP_JVM_VERSION=$v "$REPO:$TAG-jdk$v"
RC=$?
if ((RC!=0)); then
echo "Error $RC packaging $JAR"
exit $RC
fi
echo "Created: $REPO:$TAG-jdk$v"
}

TARGETS=("spring-cloud-dataflow-server/target/spring-cloud-dataflow-server" \
"spring-cloud-skipper/spring-cloud-skipper-server/target/spring-cloud-skipper-server" \
"spring-cloud-dataflow-composed-task-runner/target/spring-cloud-dataflow-composed-task-runner" \
"spring-cloud-dataflow-single-step-batch-job/target/spring-cloud-dataflow-single-step-batch-job" \
"spring-cloud-dataflow-tasklauncher/spring-cloud-dataflow-tasklauncher-sink-kafka/target/spring-cloud-dataflow-tasklauncher-sink-kafka" \
"spring-cloud-dataflow-tasklauncher/spring-cloud-dataflow-tasklauncher-sink-rabbit/target/spring-cloud-dataflow-tasklauncher-sink-rabbit")

IMAGES=("springcloud/spring-cloud-dataflow-server" \
"springcloud/spring-cloud-skipper-server" \
"springcloud/spring-cloud-dataflow-composed-task-runner" \
"springcloud/spring-cloud-dataflow-single-step-batch-job" \
"springcloud/spring-cloud-dataflow-tasklauncher-sink-kafka" \
"springcloud/spring-cloud-dataflow-tasklauncher-sink-rabbit")

len=${#TARGETS[@]}
imageLen=${#IMAGES[@]}
if ((len != imageLen)); then
echo "Expected $len == $imageLen"
exit 1
fi
for ((i = 0; i < len; i++)); do
for v in 8 11 17; do
TARGET="${TARGETS[i]}"
IMAGE="${IMAGES[i]}"
pack_image $TARGET $IMAGE $v
RC=$?
if [ $RC -ne 0 ]; then
exit $RC
fi
docker push "$IMAGE:$TAG-jdk$v"
echo "Pushed $IMAGE:$TAG-jdk$v"
if [ "$DEFAULT_JDK" == "$v" ]; then
docker tag "$IMAGE:$TAG-jdk$DEFAULT_JDK" "$IMAGE:$TAG"
docker push "$IMAGE:$TAG"
echo "Pushed $IMAGE:$TAG"
fi
done
done
35 changes: 0 additions & 35 deletions .github/actions/build-images/pack-images.sh

This file was deleted.

30 changes: 0 additions & 30 deletions .github/actions/build-images/push-images.sh

This file was deleted.

5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,7 @@ workspace/
*.log
*.shell
/*.json
*.tar
*.tar
/srp
/srp*gz
/observer/*

0 comments on commit e36af67

Please sign in to comment.