-
Notifications
You must be signed in to change notification settings - Fork 176
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Only test and scan current TP for K8s samples
- Loading branch information
Showing
108 changed files
with
207 additions
and
1 deletion.
There are no files selected for viewing
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#!/bin/bash | ||
set -euo pipefail | ||
|
||
rm -fr /tmp/result | ||
mkdir /tmp/result | ||
|
||
[[ $1 =~ (.*)-.* ]] | ||
accname=${BASH_REMATCH[1]} | ||
|
||
WORKSPACE="${TEST_WORKSPACE:-$GITHUB_WORKSPACE}" | ||
|
||
echo WORKSPACE=$WORKSPACE | ||
pushd ${WORKSPACE} | ||
|
||
CMD="${TANZU_CLI:-.github/tests/tanzu-accelerator-linux_amd64}" | ||
PLUGIN="${CLI_PLUGIN:-}" | ||
|
||
SERVER_URL="${ACC_SERVER_URL:-http://localhost:8888}" | ||
echo SERVER_URL=$SERVER_URL | ||
|
||
${CMD} ${PLUGIN} generate-from-local \ | ||
--server-url $SERVER_URL \ | ||
--output-dir /tmp/result \ | ||
--fragment-paths devcontainer=fragments/devcontainer \ | ||
--fragment-paths app-sso-client=fragments/app-sso-client \ | ||
--fragment-paths java-version=fragments/java-version \ | ||
--fragment-paths live-update=fragments/live-update \ | ||
--fragment-paths java-version=fragments/java-version \ | ||
--fragment-paths spring-boot-app-sso-auth-code-flow=fragments/spring-boot-app-sso-auth-code-flow \ | ||
--fragment-paths spring-boot-database=fragments/spring-boot-database \ | ||
--fragment-paths spring-boot-h2=fragments/spring-boot-h2 \ | ||
--fragment-paths spring-boot-mysql=fragments/spring-boot-mysql \ | ||
--fragment-paths spring-boot-postgresql=fragments/spring-boot-postgresql \ | ||
--fragment-paths steeltoe-postgresql=fragments/steeltoe-postgresql \ | ||
--fragment-paths testcontainers-mysql=fragments/testcontainers-mysql \ | ||
--fragment-paths testcontainers-postgresql=fragments/testcontainers-postgresql \ | ||
--fragment-paths tap-initialize=fragments/tap-initialize \ | ||
--fragment-paths tap-workload=fragments/tap-workload \ | ||
--fragment-paths build-wrapper-maven=fragments/build-wrapper-maven \ | ||
--fragment-paths build-wrapper-gradle=fragments/build-wrapper-gradle \ | ||
--accelerator-path ${accname}=${accname} \ | ||
$([ -f .github/tests/$1/options.json ] && echo --options-file .github/tests/$1/options.json) | ||
|
||
popd |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/bin/bash | ||
set -euo pipefail | ||
|
||
[[ $1 =~ (.*)-.* ]] | ||
|
||
WORKSPACE="${TEST_WORKSPACE:-$GITHUB_WORKSPACE}" | ||
pushd ${WORKSPACE}/.github/tests/$1 | ||
|
||
[ -f assertions.sh ] && ./assertions.sh /tmp/result | ||
|
||
popd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/bin/bash | ||
set -euo pipefail | ||
|
||
[[ $1 =~ (.*)-.* ]] | ||
grype_location=$2 | ||
|
||
pushd ${GITHUB_WORKSPACE}/.github/tests/$1 | ||
|
||
[ -f scan.sh ] && ./scan.sh /tmp/result $grype_location | ||
|
||
popd |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
#!/bin/bash | ||
|
||
# Assert that the file exists | ||
assertFileExists() | ||
{ | ||
if ! [ -f $1 ]; then | ||
echo "$1 DOES NOT exist" | ||
exit 1 | ||
fi | ||
} | ||
|
||
# Assert that a file does NOT exist | ||
assertFileDoesntExist() | ||
{ | ||
if [ -f $1 ]; then | ||
echo "$1 SHOULD NOT exist" | ||
exit 1 | ||
fi | ||
} | ||
|
||
# Assert that a directory does NOT exist | ||
assertDirDoesntExist() | ||
{ | ||
if [ -d $1 ]; then | ||
echo "$1 SHOULD NOT exist" | ||
exit 1 | ||
fi | ||
} | ||
|
||
# Assert that a file contains some string | ||
assertFileContains() | ||
{ | ||
if ! grep -Fq "$2" $1; then | ||
echo "$1 DOES NOT contain \"$2\"" | ||
exit 1 | ||
fi | ||
} | ||
|
||
# Assert that a file DOES NOT contain some string | ||
assertFileDoesntContain() | ||
{ | ||
if grep -Fq "$2" $1; then | ||
echo "$1 SHOULD NOT contain \"$2\"" | ||
exit 1 | ||
fi | ||
} | ||
|
||
# Assert project's groupId and artifactId | ||
assertPomHasProjectCoordinates() | ||
{ | ||
DEPTEST="//project[groupId=\"$2\"][artifactId=\"$3\"]" | ||
DEPRESULT=`xpath -e $DEPTEST -q $1 2>/dev/null` | ||
if [ ${#DEPRESULT} -eq "0" ]; then | ||
echo "$1 does not have project coordinates \"$2:$3\"" | ||
exit 1 | ||
fi | ||
} | ||
|
||
# Assert that the pom has a given dependency | ||
assertPomHasDependency() | ||
{ | ||
DEPTEST="//project/dependencies/dependency[groupId=\"$2\"][artifactId=\"$3\"]" | ||
if [ $# -gt 3 ]; then | ||
DEPTEST="$DEPTEST[version=\"$4\"]" | ||
fi | ||
|
||
DEPRESULT=`xpath -e $DEPTEST -q $1 2>/dev/null` | ||
if [ ${#DEPRESULT} -eq "0" ]; then | ||
echo "$1 does not contain dependency \"$2:$3:$4\"" | ||
exit 1 | ||
fi | ||
} | ||
|
||
# Assert that the pom DOES NOT have a given dependency | ||
assertPomDoesntHaveDependency() | ||
{ | ||
DEPTEST="//project/dependencies/dependency[groupId=\"$2\"][artifactId=\"$3\"]" | ||
if [ $# -gt 3 ]; then | ||
DEPTEST="$DEPTEST[version=\"$4\"]" | ||
fi | ||
|
||
DEPRESULT=`xpath -e $DEPTEST -q $1 2>/dev/null` | ||
if ! [ ${#DEPRESULT} -eq "0" ]; then | ||
echo "$1 does not contain dependency \"$2:$3:$4\"" | ||
exit 1 | ||
fi | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
18 changes: 18 additions & 0 deletions
18
.github/tests/tanzu-java-web-app-gradle_java21/assertions.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/bin/bash | ||
set -euo pipefail | ||
|
||
pushd $1 | ||
|
||
if [ -f pom.xml ]; then | ||
echo "FAIL: Found pom.xml file!" | ||
exit 5 | ||
fi | ||
|
||
if ! grep -q 'JavaVersion.VERSION_21' build.gradle.kts; then | ||
echo "Couldn't find Java version 21" | ||
exit 2 | ||
fi | ||
|
||
./gradlew build | ||
|
||
popd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"projectName": "tanzu-java-web-app", | ||
"buildTool": "gradle", | ||
"javaVersion": "21", | ||
"includeBuildToolWrapper": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/bin/bash | ||
set -euxo pipefail | ||
|
||
pushd $1 | ||
|
||
if ls | grep -q gradle; then | ||
echo "FAIL: There are gradle related files present." | ||
exit 1 | ||
fi | ||
|
||
./mvnw package | ||
|
||
popd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"projectName": "tanzu-java-web-app", | ||
"buildTool": "maven", | ||
"javaVersion": "17", | ||
"includeBuildToolWrapper": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/bin/bash | ||
set -euxo pipefail | ||
|
||
pushd $1 | ||
grype=$2 | ||
|
||
./mvnw package | ||
$grype target/demo-0.0.1-SNAPSHOT.jar --fail-on high --config ${GITHUB_WORKSPACE}/.github/tests/.grype.yaml | ||
|
||
popd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters