forked from spring-cloud/spring-cloud-dataflow
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build-carvel-package.sh
executable file
·59 lines (44 loc) · 2.21 KB
/
build-carvel-package.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/bin/bash
function create_and_clear() {
rm -rf "$1"
mkdir -p "$1"
}
SCDIR=$(realpath $(dirname "$(readlink -f "${BASH_SOURCE[0]}")"))
set -euxo pipefail
pushd $SCDIR > /dev/null
export DATAFLOW_VERSION=$(./mvnw help:evaluate -o -Dexpression=project.version -q -DforceStdout)
export SKIPPER_VERSION=$(./mvnw help:evaluate -o -Dexpression=spring-cloud-skipper.version -pl spring-cloud-dataflow-parent -q -DforceStdout)
if [ "$PACKAGE_VERSION" = "" ]; then
export PACKAGE_VERSION=$DATAFLOW_VERSION
fi
# you can launch a local docker registry using docker run -d -p 5000:5000 --name registry registry:2.7
# export REPO_PREFIX="<local-machine-ip>:5000/"
readonly REPO_PREFIX="${REPO_PREFIX:-docker.io/}"
export PACKAGE_BUNDLE_REPOSITORY="${REPO_PREFIX}springcloud/scdf-oss-package"
export REPOSITORY_BUNDLE="${REPO_PREFIX}springcloud/scdf-oss-repo"
export SKIPPER_REPOSITORY="springcloud/spring-cloud-skipper-server"
export SERVER_REPOSITORY="springcloud/spring-cloud-dataflow-server"
export CTR_VERSION=$DATAFLOW_VERSION
export PACKAGE_NAME="scdf"
export PACKAGE_BUNDLE_TEMPLATE="src/carvel/templates/bundle/package"
export IMGPKG_LOCK_TEMPLATE="src/carvel/templates/imgpkg"
export VENDIR_SRC_IN="src/carvel/config"
export SERVER_VERSION="$DATAFLOW_VERSION"
export PACKAGE_BUNDLE_GENERATED=/tmp/generated/packagebundle
export IMGPKG_LOCK_GENERATED_IN=/tmp/generated/imgpkgin
export IMGPKG_LOCK_GENERATED_OUT=/tmp/generated/imgpkgout
create_and_clear $PACKAGE_BUNDLE_GENERATED
create_and_clear $IMGPKG_LOCK_GENERATED_IN
create_and_clear $IMGPKG_LOCK_GENERATED_OUT
echo "bundle-path=$PACKAGE_BUNDLE_GENERATED"
export SCDF_DIR="$SCDIR"
sh "$SCDIR/.github/actions/build-package-bundle/build-package-bundle.sh"
imgpkg push --bundle "$PACKAGE_BUNDLE_REPOSITORY:$PACKAGE_VERSION" --file "$PACKAGE_BUNDLE_GENERATED"
export REPO_BUNDLE_TEMPLATE="src/carvel/templates/bundle/repo"
export REPO_BUNDLE_RENDERED=/tmp/generated/reporendered
export REPO_BUNDLE_GENERATED=/tmp/generated/repobundle
create_and_clear $REPO_BUNDLE_RENDERED
create_and_clear $REPO_BUNDLE_GENERATED
sh "$SCDIR/.github/actions/build-repository-bundle/build-repository-bundle.sh"
imgpkg push --bundle "$REPOSITORY_BUNDLE:$PACKAGE_VERSION" --file "$REPO_BUNDLE_GENERATED"
popd