[CI] Update ci-pr to ensure apps are integration tests and not deployed when they are in the dependency tree.
This commit is contained in:
22
.github/workflows/ci-pr.yml
vendored
22
.github/workflows/ci-pr.yml
vendored
@@ -6,7 +6,7 @@ on:
|
||||
env:
|
||||
MAIN_PATH: 'build-dir'
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
MAVEN_THREADS: 'false'
|
||||
MAVEN_THREADS: 'true'
|
||||
jobs:
|
||||
build:
|
||||
if: github.repository == 'spring-cloud/stream-applications'
|
||||
@@ -66,7 +66,7 @@ jobs:
|
||||
FOLDERS=
|
||||
ROOT_MODULES=
|
||||
if [ "$MAVEN_THREADS" = "true" ]; then
|
||||
MVN_THR="-T 0.3C"
|
||||
MVN_THR="-T 0.5C"
|
||||
else
|
||||
MVN_THR=
|
||||
fi
|
||||
@@ -95,7 +95,7 @@ jobs:
|
||||
# Module with no / are probably a root module that contains other modules and will trigger a lot of dependant builds without real value
|
||||
echo "::info ::building $ROOT_MODULES"
|
||||
echo "::debug ::MAVEN:./mvnw $MAVEN_OPTS -pl $ROOT_MODULES install"
|
||||
./mvnw $MAVEN_OPTS -pl $ROOT_MODULES install -Pintegration
|
||||
./mvnw $MAVEN_OPTS -pl $ROOT_MODULES install
|
||||
RC=$?
|
||||
if ((RC!=0)); then
|
||||
exit $RC
|
||||
@@ -104,12 +104,26 @@ jobs:
|
||||
if [ "$FOLDERS" != "" ]; then
|
||||
echo "::info ::verify $FOLDERS and dependents"
|
||||
echo "::debug ::MAVEN:./mvnw $MAVEN_OPTS -amd -pl $FOLDERS install"
|
||||
./mvnw $MAVEN_OPTS -amd -pl $FOLDERS install -Pintegration
|
||||
./mvnw $MAVEN_OPTS -amd -pl $FOLDERS install
|
||||
RC=$?
|
||||
if ((RC!=0)); then
|
||||
exit $RC
|
||||
fi
|
||||
fi
|
||||
# Build any applications that was compiled but don't deploy to artifactory.
|
||||
PROCESSORS=$(find ./applications/processor -name target -exec ./parent-dir '{}' \;)
|
||||
SINKS=$(find ./applications/sink -name target -exec ./parent-dir '{}' \;)
|
||||
SOURCES=$(find ./applications/source -name target -exec ./parent-dir '{}' \;)
|
||||
# true as 3rd argument ensures that jars aren't deployed and containers aren't built.
|
||||
for appdir in $PROCESSORS; do
|
||||
./build-app.sh . "./$appdir" true
|
||||
done
|
||||
for appdir in $SOURCES; do
|
||||
./build-app.sh . "./$appdir" true
|
||||
done
|
||||
for appdir in $SINKS; do
|
||||
./build-app.sh . "./$appdir" true
|
||||
done
|
||||
- name: 'Upload: Error logs'
|
||||
if: ${{ failure() }}
|
||||
uses: actions/upload-artifact@v3
|
||||
|
||||
43
build-app.sh
43
build-app.sh
@@ -23,6 +23,7 @@ if [ "$2" == "" ]; then
|
||||
fi
|
||||
PROJECT_FOLDER=$(realpath "$1")
|
||||
APP_FOLDER=$2
|
||||
SKIP_DEPLOY=$3
|
||||
|
||||
set -e
|
||||
check_env ARTIFACTORY_USERNAME
|
||||
@@ -34,7 +35,7 @@ pushd "$PROJECT_FOLDER" >/dev/null
|
||||
fi
|
||||
|
||||
echo "Project Version:$VERSION"
|
||||
if [ "$LOCAL" == "true" ]; then
|
||||
if [ "$LOCAL" == "true" ] || [ "$SKIP_DEPLOY" == "true" ]; then
|
||||
MAVEN_GOAL="install verify"
|
||||
else
|
||||
MAVEN_GOAL="install verify deploy"
|
||||
@@ -83,25 +84,27 @@ pushd "$PROJECT_FOLDER" >/dev/null
|
||||
FOLDER=$(pwd)
|
||||
echo "Building:$FOLDER"
|
||||
$SCDIR/build-folder.sh "." "$MAVEN_GOAL -Pintegration"
|
||||
for v in $JDKS; do
|
||||
echo "Pack:$app:$VERSION-jdk$v"
|
||||
pack build \
|
||||
--path "target/$app-$VERSION.jar" \
|
||||
--builder gcr.io/paketo-buildpacks/builder:base \
|
||||
--env BP_JVM_VERSION=$v \
|
||||
--env BPE_APPEND_JDK_JAVA_OPTIONS=-Dfile.encoding=UTF-8 \
|
||||
--env BPE_APPEND_JDK_JAVA_OPTIONS=-Dsun.jnu.encoding \
|
||||
--env BPE_LC_ALL=en_US.utf8 \
|
||||
--env BPE_LANG=en_US.utf8 \
|
||||
"springcloudstream/$app:$VERSION-jdk$v"
|
||||
echo "Created:springcloudstream/$app:$VERSION-jdk$v"
|
||||
done
|
||||
if [ "$DEFAULT_JDK" != "" ]; then
|
||||
docker tag "springcloudstream/$app:$VERSION-jdk$DEFAULT_JDK" "springcloudstream/$app:$VERSION"
|
||||
echo "Tagged:springcloudstream/$app:$VERSION-jdk$DEFAULT_JDK as springcloudstream/$app:$VERSION"
|
||||
if [ "$BRANCH" != "" ]; then
|
||||
docker tag "springcloudstream/$app:$VERSION-jdk$DEFAULT_JDK" "springcloudstream/$app:$BRANCH"
|
||||
echo "Tagged:springcloudstream/$app:$VERSION-jdk$DEFAULT_JDK as springcloudstream/$app:$BRANCH"
|
||||
if [ "$SKIP_DEPLOY" == "" ] || [ "$SKIP_DEPLOY" == "false" ]; then
|
||||
for v in $JDKS; do
|
||||
echo "Pack:$app:$VERSION-jdk$v"
|
||||
pack build \
|
||||
--path "target/$app-$VERSION.jar" \
|
||||
--builder gcr.io/paketo-buildpacks/builder:base \
|
||||
--env BP_JVM_VERSION=$v \
|
||||
--env BPE_APPEND_JDK_JAVA_OPTIONS=-Dfile.encoding=UTF-8 \
|
||||
--env BPE_APPEND_JDK_JAVA_OPTIONS=-Dsun.jnu.encoding \
|
||||
--env BPE_LC_ALL=en_US.utf8 \
|
||||
--env BPE_LANG=en_US.utf8 \
|
||||
"springcloudstream/$app:$VERSION-jdk$v"
|
||||
echo "Created:springcloudstream/$app:$VERSION-jdk$v"
|
||||
done
|
||||
if [ "$DEFAULT_JDK" != "" ]; then
|
||||
docker tag "springcloudstream/$app:$VERSION-jdk$DEFAULT_JDK" "springcloudstream/$app:$VERSION"
|
||||
echo "Tagged:springcloudstream/$app:$VERSION-jdk$DEFAULT_JDK as springcloudstream/$app:$VERSION"
|
||||
if [ "$BRANCH" != "" ]; then
|
||||
docker tag "springcloudstream/$app:$VERSION-jdk$DEFAULT_JDK" "springcloudstream/$app:$BRANCH"
|
||||
echo "Tagged:springcloudstream/$app:$VERSION-jdk$DEFAULT_JDK as springcloudstream/$app:$BRANCH"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
popd >/dev/null
|
||||
|
||||
42
parent-dir.sh
Executable file
42
parent-dir.sh
Executable file
@@ -0,0 +1,42 @@
|
||||
#!/usr/bin/env bash
|
||||
function relativepath() {
|
||||
source=$(realpath "$1")
|
||||
target=$(realpath "$2")
|
||||
|
||||
common_part=$source # for now
|
||||
result="" # for now
|
||||
|
||||
while [[ "${target#$common_part}" == "${target}" ]]; do
|
||||
# no match, means that candidate common part is not correct
|
||||
# go up one level (reduce common part)
|
||||
common_part="$(dirname $common_part)"
|
||||
# and record that we went back, with correct / handling
|
||||
if [[ -z $result ]]; then
|
||||
result=".."
|
||||
else
|
||||
result="../$result"
|
||||
fi
|
||||
done
|
||||
|
||||
if [[ $common_part == "/" ]]; then
|
||||
# special case for root (no common path)
|
||||
result="$result/"
|
||||
fi
|
||||
|
||||
# since we now have identified the common part,
|
||||
# compute the non-common part
|
||||
forward_part="${target#$common_part}"
|
||||
|
||||
# and now stick all parts together
|
||||
if [[ -n $result ]] && [[ -n $forward_part ]]; then
|
||||
result="$result$forward_part"
|
||||
elif [[ -n $forward_part ]]; then
|
||||
# extra slash removal
|
||||
result="${forward_part:1}"
|
||||
fi
|
||||
|
||||
echo $result
|
||||
}
|
||||
DIR="$1"
|
||||
PARENT="$DIR/.."
|
||||
relativepath "$PWD" "$PARENT"
|
||||
Reference in New Issue
Block a user