Skip to content

Commit

Permalink
[CI] Update load-image and register-apps.sh for separation of Stream …
Browse files Browse the repository at this point in the history
…Apps Release Train and Version.
  • Loading branch information
corneil committed Jul 9, 2024
1 parent 6ef48c8 commit 5c4ad1f
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 38 deletions.
18 changes: 9 additions & 9 deletions src/deploy/carvel/register-apps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ if [ "$TYPE" = "" ]; then
TYPE=docker
fi
if [ "$1" != "" ]; then
STREAM_APPS_VERSION=$1
STREAM_APPS_RT_VERSION=$1
fi

if [ "$BROKER" == "kafka" ]; then
Expand All @@ -44,25 +44,25 @@ else
BROKER_NAME=rabbitmq
fi

if [ "$STREAM_APPS_VERSION" = "" ]; then
if [ "$STREAM_APPS_RT_VERSION" = "" ]; then
STREAM_URI="https://dataflow.spring.io/$BROKER_NAME-${TYPE}-latest"
elif [[ "$STREAM_APPS_VERSION" = *"SNAPSHOT"* ]]; then
STREAM_APPS_DL_VERSION=$STREAM_APPS_VERSION
META_DATA="https://repo.spring.io/snapshot/org/springframework/cloud/stream/app/stream-applications-descriptor/${STREAM_APPS_VERSION}/maven-metadata.xml"
elif [[ "$STREAM_APPS_RT_VERSION" = *"SNAPSHOT"* ]]; then
STREAM_APPS_DL_VERSION=$STREAM_APPS_RT_VERSION
META_DATA="https://repo.spring.io/snapshot/org/springframework/cloud/stream/app/stream-applications-descriptor/${STREAM_APPS_RT_VERSION}/maven-metadata.xml"
echo "Downloading $META_DATA"
curl -o maven-metadata.xml -s $META_DATA
DL_TS=$(xmllint --xpath "/metadata/versioning/snapshot/timestamp/text()" maven-metadata.xml | sed 's/\.//')
STREAM_APPS_DL_VERSION=$(xmllint --xpath "/metadata/versioning/snapshotVersions/snapshotVersion[extension/text() = 'pom' and updated/text() = '$DL_TS']/value/text()" maven-metadata.xml)
STREAM_URI="https://repo.spring.io/snapshot/org/springframework/cloud/stream/app/stream-applications-descriptor/${STREAM_APPS_VERSION}/stream-applications-descriptor-${STREAM_APPS_DL_VERSION}.stream-apps-${BROKER_NAME}-${TYPE}"
STREAM_URI="https://repo.spring.io/snapshot/org/springframework/cloud/stream/app/stream-applications-descriptor/${STREAM_APPS_RT_VERSION}/stream-applications-descriptor-${STREAM_APPS_DL_VERSION}.stream-apps-${BROKER_NAME}-${TYPE}"
else
REL_TYPE=
if [[ "$STREAM_APPS_VERSION" = *"-M"* ]] || [[ "$STREAM_APPS_VERSION" = *"-RC"* ]]; then
if [[ "$STREAM_APPS_RT_VERSION" = *"-M"* ]] || [[ "$STREAM_APPS_RT_VERSION" = *"-RC"* ]]; then
REL_TYPE=milestone
fi
if [ "$REL_TYPE" != "" ]; then
STREAM_URI="https://repo.spring.io/$REL_TYPE/org/springframework/cloud/stream/app/stream-applications-descriptor/${STREAM_APPS_VERSION}/stream-applications-descriptor-${STREAM_APPS_VERSION}.stream-apps-${BROKER_NAME}-${TYPE}"
STREAM_URI="https://repo.spring.io/$REL_TYPE/org/springframework/cloud/stream/app/stream-applications-descriptor/${STREAM_APPS_RT_VERSION}/stream-applications-descriptor-${STREAM_APPS_RT_VERSION}.stream-apps-${BROKER_NAME}-${TYPE}"
else
STREAM_URI="https://repo.maven.apache.org/maven2/org/springframework/cloud/stream/app/stream-applications-descriptor/${STREAM_APPS_VERSION}/stream-applications-descriptor-${STREAM_APPS_VERSION}.stream-apps-${BROKER_NAME}-${TYPE}"
STREAM_URI="https://repo.maven.apache.org/maven2/org/springframework/cloud/stream/app/stream-applications-descriptor/${STREAM_APPS_RT_VERSION}/stream-applications-descriptor-${STREAM_APPS_RT_VERSION}.stream-apps-${BROKER_NAME}-${TYPE}"
fi
fi
if [ "$DATAFLOW_URL" = "" ]; then
Expand Down
9 changes: 5 additions & 4 deletions src/deploy/k8s/load-image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,15 @@ case "$K8S_DRIVER" in
docker push localhost:32000/$IMAGE
;;
*)
MINIKUBE_JSON=$(minikube image ls --format json | jq -c --arg image $IMAGE '.[] | {id: .id, image: .repoTags[0]} | select(.image | contains($image))')
MINIKUBE_RAW_JSON=$(minikube image ls --format json)
MINIKUBE_JSON=$(echo "$MINIKUBE_RAW_JSON" | jq -c --arg image $IMAGE '.[] | {id: .id, image: .repoTags[0]} | select(.image | endswith($image))')
if [ "$MINIKUBE_JSON" != "" ]; then
MINIKUBE_SHA="sha256:$(echo $MINIKUBE_JSON | jq -r '.id')"
if [ "$MINIKUBE_SHA" = "$DOCKER_SHA" ]; then
if [ "$MINIKUBE_SHA" != "$DOCKER_SHA" ]; then
echo "Image: $IMAGE, docker $DOCKER_SHA, minikube $MINIKUBE_SHA"
else
echo "$IMAGE already uploaded"
exit 0
else
echo "Image: $IMAGE, docker $DOCKER_SHA, minikube $MINIKUBE_SHA"
fi
fi
echo "Loading $IMAGE to minikube"
Expand Down
26 changes: 13 additions & 13 deletions src/deploy/k8s/register-apps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,36 +43,36 @@ if [ "$BROKER" = "rabbitmq" ]; then
else
BROKER_NAME=$BROKER
fi
if [ "$STREAM_APPS_VERSION" = "" ]; then
# export STREAM_APPS_VERSION=2022.0.0-SNAPSHOT
# export STREAM_APPS_VERSION=2021.1.2 # release for Boot 2.x
# export STREAM_APPS_VERSION=2022.0.0 # release for Boot 3.x
export STREAM_APPS_VERSION=2022.0.0
if [ "$STREAM_APPS_RT_VERSION" = "" ]; then
# export STREAM_APPS_RT_VERSION=2022.0.0-SNAPSHOT
# export STREAM_APPS_RT_VERSION=2021.1.2 # release for Boot 2.x
# export STREAM_APPS_RT_VERSION=2022.0.0 # release for Boot 3.x
export STREAM_APPS_RT_VERSION=2022.0.0
fi
echo "STREAM_APPS_VERSION=$STREAM_APPS_VERSION"
echo "STREAM_APPS_RT_VERSION=$STREAM_APPS_RT_VERSION"
if [ "$PLATFORM_TYPE" != "kubernetes" ]; then
TYPE=maven
else
TYPE=docker
fi

if [[ "$STREAM_APPS_VERSION" = *"-SNAPSHOT"* ]]; then
STREAM_APPS_DL_VERSION=$STREAM_APPS_VERSION
META_DATA="https://repo.spring.io/snapshot/org/springframework/cloud/stream/app/stream-applications-descriptor/${STREAM_APPS_VERSION}/maven-metadata.xml"
if [[ "$STREAM_APPS_RT_VERSION" = *"-SNAPSHOT"* ]]; then
STREAM_APPS_DL_VERSION=$STREAM_APPS_RT_VERSION
META_DATA="https://repo.spring.io/snapshot/org/springframework/cloud/stream/app/stream-applications-descriptor/${STREAM_APPS_RT_VERSION}/maven-metadata.xml"
echo "Downloading $META_DATA"
curl -o maven-metadata.xml -s $META_DATA
DL_TS=$(xmllint --xpath "/metadata/versioning/snapshot/timestamp/text()" maven-metadata.xml | sed 's/\.//')
STREAM_APPS_DL_VERSION=$(xmllint --xpath "/metadata/versioning/snapshotVersions/snapshotVersion[extension/text() = 'pom' and updated/text() = '$DL_TS']/value/text()" maven-metadata.xml)
DESCRIPTORS="https://repo.spring.io/snapshot/org/springframework/cloud/stream/app/stream-applications-descriptor/${STREAM_APPS_VERSION}/stream-applications-descriptor-${STREAM_APPS_DL_VERSION}.stream-apps-${BROKER_NAME}-${TYPE}"
DESCRIPTORS="https://repo.spring.io/snapshot/org/springframework/cloud/stream/app/stream-applications-descriptor/${STREAM_APPS_RT_VERSION}/stream-applications-descriptor-${STREAM_APPS_DL_VERSION}.stream-apps-${BROKER_NAME}-${TYPE}"
else
REL_TYPE=
if [[ "$STREAM_APPS_VERSION" = *"-M"* ]] || [[ "$STREAM_APPS_VERSION" = *"-RC"* ]]; then
if [[ "$STREAM_APPS_RT_VERSION" = *"-M"* ]] || [[ "$STREAM_APPS_RT_VERSION" = *"-RC"* ]]; then
REL_TYPE=milestone
fi
if [ "$REL_TYPE" != "" ]; then
DESCRIPTORS="https://repo.spring.io/$REL_TYPE/org/springframework/cloud/stream/app/stream-applications-descriptor/${STREAM_APPS_VERSION}/stream-applications-descriptor-${STREAM_APPS_VERSION}.stream-apps-${BROKER_NAME}-${TYPE}"
DESCRIPTORS="https://repo.spring.io/$REL_TYPE/org/springframework/cloud/stream/app/stream-applications-descriptor/${STREAM_APPS_RT_VERSION}/stream-applications-descriptor-${STREAM_APPS_RT_VERSION}.stream-apps-${BROKER_NAME}-${TYPE}"
else
DESCRIPTORS="https://repo.maven.apache.org/maven2/org/springframework/cloud/stream/app/stream-applications-descriptor/${STREAM_APPS_VERSION}/stream-applications-descriptor-${STREAM_APPS_VERSION}.stream-apps-${BROKER_NAME}-${TYPE}"
DESCRIPTORS="https://repo.maven.apache.org/maven2/org/springframework/cloud/stream/app/stream-applications-descriptor/${STREAM_APPS_RT_VERSION}/stream-applications-descriptor-${STREAM_APPS_RT_VERSION}.stream-apps-${BROKER_NAME}-${TYPE}"
fi
fi
echo "DATAFLOW_IP=$DATAFLOW_IP"
Expand Down
24 changes: 12 additions & 12 deletions src/local/register-apps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,31 +38,31 @@ if [ "$BROKER" = "rabbitmq" ]; then
else
BROKER_NAME=$BROKER
fi
if [ "$STREAM_APPS_VERSION" = "" ]; then
export STREAM_APPS_VERSION=2022.0.0
# export STREAM_APPS_VERSION=2021.1.2 # release for Boot 2.x
# export STREAM_APPS_VERSION=2022.0.0 # release for Boot 3.x
if [ "$STREAM_APPS_RT_VERSION" = "" ]; then
export STREAM_APPS_RT_VERSION=2022.0.0
# export STREAM_APPS_RT_VERSION=2021.1.2 # release for Boot 2.x
# export STREAM_APPS_RT_VERSION=2022.0.0 # release for Boot 3.x
fi
echo "STREAM_APPS_VERSION=$STREAM_APPS_VERSION"
echo "STREAM_APPS_RT_VERSION=$STREAM_APPS_RT_VERSION"
TYPE=maven

if [[ "$STREAM_APPS_VERSION" = *"-SNAPSHOT"* ]]; then
STREAM_APPS_DL_VERSION=$STREAM_APPS_VERSION
META_DATA="https://repo.spring.io/snapshot/org/springframework/cloud/stream/app/stream-applications-descriptor/${STREAM_APPS_VERSION}/maven-metadata.xml"
if [[ "$STREAM_APPS_RT_VERSION" = *"-SNAPSHOT"* ]]; then
STREAM_APPS_DL_VERSION=$STREAM_APPS_RT_VERSION
META_DATA="https://repo.spring.io/snapshot/org/springframework/cloud/stream/app/stream-applications-descriptor/${STREAM_APPS_RT_VERSION}/maven-metadata.xml"
echo "Downloading $META_DATA"
curl -o maven-metadata.xml -s $META_DATA
DL_TS=$(xmllint --xpath "/metadata/versioning/snapshot/timestamp/text()" maven-metadata.xml | sed 's/\.//')
STREAM_APPS_DL_VERSION=$(xmllint --xpath "/metadata/versioning/snapshotVersions/snapshotVersion[extension/text() = 'pom' and updated/text() = '$DL_TS']/value/text()" maven-metadata.xml)
DESCRIPTORS="https://repo.spring.io/snapshot/org/springframework/cloud/stream/app/stream-applications-descriptor/${STREAM_APPS_VERSION}/stream-applications-descriptor-${STREAM_APPS_DL_VERSION}.stream-apps-${BROKER_NAME}-${TYPE}"
DESCRIPTORS="https://repo.spring.io/snapshot/org/springframework/cloud/stream/app/stream-applications-descriptor/${STREAM_APPS_RT_VERSION}/stream-applications-descriptor-${STREAM_APPS_DL_VERSION}.stream-apps-${BROKER_NAME}-${TYPE}"
else
REL_TYPE=
if [[ "$STREAM_APPS_VERSION" = *"-M"* ]] || [[ "$STREAM_APPS_VERSION" = *"-RC"* ]]; then
if [[ "$STREAM_APPS_RT_VERSION" = *"-M"* ]] || [[ "$STREAM_APPS_RT_VERSION" = *"-RC"* ]]; then
REL_TYPE=milestone
fi
if [ "$REL_TYPE" != "" ]; then
DESCRIPTORS="https://repo.spring.io/$REL_TYPE/org/springframework/cloud/stream/app/stream-applications-descriptor/${STREAM_APPS_VERSION}/stream-applications-descriptor-${STREAM_APPS_VERSION}.stream-apps-${BROKER_NAME}-${TYPE}"
DESCRIPTORS="https://repo.spring.io/$REL_TYPE/org/springframework/cloud/stream/app/stream-applications-descriptor/${STREAM_APPS_RT_VERSION}/stream-applications-descriptor-${STREAM_APPS_RT_VERSION}.stream-apps-${BROKER_NAME}-${TYPE}"
else
DESCRIPTORS="https://repo.maven.apache.org/maven2/org/springframework/cloud/stream/app/stream-applications-descriptor/${STREAM_APPS_VERSION}/stream-applications-descriptor-${STREAM_APPS_VERSION}.stream-apps-${BROKER_NAME}-${TYPE}"
DESCRIPTORS="https://repo.maven.apache.org/maven2/org/springframework/cloud/stream/app/stream-applications-descriptor/${STREAM_APPS_RT_VERSION}/stream-applications-descriptor-${STREAM_APPS_RT_VERSION}.stream-apps-${BROKER_NAME}-${TYPE}"
fi
fi
echo "DATAFLOW_IP=$DATAFLOW_IP"
Expand Down

0 comments on commit 5c4ad1f

Please sign in to comment.