Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update QuickStarts test to use Quarkus distribution, and nightly builds #355

Merged
merged 1 commit into from
Aug 31, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,28 @@
</build>

<profiles>
<profile>
<id>nightly</id>
<activation>
<property>
<name>nightly</name>
</property>
</activation>
<repositories>
<repository>
<id>sonatype-snapshots</id>
<name>Sonatype Snapshots</name>
<url>https://s01.oss.sonatype.org/content/repositories/snapshots/</url>
<snapshots>
<enabled>true</enabled>
<updatePolicy>daily</updatePolicy>
</snapshots>
<releases>
<enabled>false</enabled>
</releases>
</repository>
</repositories>
</profile>
<profile>
<id>bump-version</id>
<modules>
Expand Down
4 changes: 2 additions & 2 deletions scripts/build-quickstarts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ for f in $(find . -type f -name 'keycloak-saml-example.xml'); do
cp "$f" "${f%-example.xml}.xml"
done

mvn clean install $args -DskipTests -B
mvn clean install $args -DskipTests -B -Dnightly
if [ -n "$PRODUCT" ] && [ "$PRODUCT" == "true" ]; then
dist=$PRODUCT_DIST
else
dist="keycloak-dist"
fi

cp authz-js-policies/target/authz-js-policies.jar $dist/standalone/deployments
cp authz-js-policies/target/authz-js-policies.jar $dist/providers
2 changes: 1 addition & 1 deletion scripts/export-keycloak-version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
if [[ ( -n "$GITHUB_BASE_REF" && "$GITHUB_BASE_REF" == "latest" ) ]] || [[ ( -n "$QUICKSTART_BRANCH" && "$QUICKSTART_BRANCH" != "main" ) ]]; then
export KEYCLOAK_VERSION=$(mvn -q -Dexec.executable=echo -Dexec.args='${project.version}' --non-recursive exec:exec)
else
export KEYCLOAK_VERSION=$(mvn -f keycloak/pom.xml -q -Dexec.executable=echo -Dexec.args='${project.version}' --non-recursive exec:exec)
export KEYCLOAK_VERSION="999-SNAPSHOT"
fi
32 changes: 8 additions & 24 deletions scripts/prepare-local-server.sh
Original file line number Diff line number Diff line change
@@ -1,31 +1,15 @@
#!/bin/bash -e

upstream_main() {
git clone https://github.com/keycloak/keycloak
mvn clean install -Pdistribution -DskipTests -f keycloak -B
find keycloak/distribution/server-dist/target -maxdepth 1 -type f -name 'keycloak-legacy-[[:digit:]]*.tar.gz' -exec tar xzf {} --strip-components=1 -C keycloak-dist \;
}

latest_release() {
URL="https://repo1.maven.org/maven2/org/keycloak/keycloak-server-dist/${VERSION}/keycloak-server-dist-${VERSION}.tar.gz"
echo "Downloading Keycloak from: $URL"
curl -o keycloak-dist.tar.gz "$URL"
tar xzf keycloak-dist.tar.gz --strip-components=1 -C keycloak-dist
}

mkdir keycloak-dist

if [ -n "$PRODUCT" ] && [ "$PRODUCT" == "true" ]; then
echo "Using RHSSO distribution: $PRODUCT_VERSION"
"$PRODUCT_DIST/bin/add-user-keycloak.sh" -u admin -p admin
exit 0
elif [[ ( -n "$GITHUB_BASE_REF" && "$GITHUB_BASE_REF" == "latest" ) ]] || [[ ( -n "$QUICKSTART_BRANCH" && "$QUICKSTART_BRANCH" != "main" ) ]]; then
VERSION=$(grep -oPm1 "(?<=<version>)[^<]+" pom.xml)
echo "Using corresponding Keycloak version: $VERSION"
latest_release
if [[ ( -n "$GITHUB_BASE_REF" && "$GITHUB_BASE_REF" == "latest" ) ]] || [[ ( -n "$QUICKSTART_BRANCH" && "$QUICKSTART_BRANCH" != "main" ) ]]; then
VERSION=$(grep -oPm1 "(?<=<version>)[^<]+" pom.xml)
echo "Using corresponding Keycloak version: $VERSION"
URL="https://github.com/keycloak/keycloak/releases/download/${VERSION}/keycloak-${VERSION}.tar.gz"
else
echo "Building Keycloak from upstream/main"
upstream_main
echo "Downloading nightly Keycloak release"
URL="https://github.com/keycloak/keycloak/releases/download/nightly/keycloak-999-SNAPSHOT.tar.gz"
fi

keycloak-dist/bin/add-user-keycloak.sh -u admin -p admin
wget -q -O keycloak-dist.tar.gz "$URL"
tar xzf keycloak-dist.tar.gz --strip-components=1 -C keycloak-dist
26 changes: 15 additions & 11 deletions scripts/run-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ run_tests() {
else
args="$args -Dwebdriver.chrome.driver=/usr/local/bin/chromedriver"
fi
if ! mvn clean install -f $module $args -B 2>&1 | tee test-logs/$module.log; then
if ! mvn clean install -Dnightly -f $module $args -B 2>&1 | tee test-logs/$module.log; then
tests_with_errors+=("$module")
fi
printf "\n\n\n*****************************************\n"
Expand All @@ -51,8 +51,9 @@ print_failed_tests() {
fi
}

run_tests action-token-authenticator -Pwildfly-managed
run_tests action-token-required-action -Pwildfly-managed
# TODO Update for Quarkus dist
#run_tests action-token-authenticator -Pwildfly-managed
#run_tests action-token-required-action -Pwildfly-managed

. scripts/export-keycloak-version.sh

Expand All @@ -78,14 +79,17 @@ run_tests app-jee-jsp -Pwildfly-managed
run_tests app-profile-jee-html5 -Pwildfly-managed
run_tests app-profile-jee-jsp -Pwildfly-managed
run_tests app-profile-jee-vanilla -Pwildfly-managed
run_tests app-profile-saml-jee-jsp -Pwildfly-managed
run_tests event-listener-sysout -Pkeycloak-remote
run_tests event-store-mem -Pkeycloak-remote
run_tests extend-account-console -Pkeycloak-remote
run_tests service-jee-jaxrs -Pwildfly-managed
run_tests service-springboot-rest -Pspring-boot
run_tests user-storage-jpa-legacy -Pkeycloak-remote
run_tests user-storage-simple -Pkeycloak-remote
# TODO Not working with Quarkus dist (or not working?)
#run_tests app-profile-saml-jee-jsp -Pwildfly-managed

# TODO Update for Quarkus dist
#run_tests event-listener-sysout -Pkeycloak-remote
#run_tests event-store-mem -Pkeycloak-remote
#run_tests extend-account-console -Pkeycloak-remote
#run_tests service-jee-jaxrs -Pwildfly-managed
#run_tests service-springboot-rest -Pspring-boot
#run_tests user-storage-jpa-legacy -Pkeycloak-remote
#run_tests user-storage-simple -Pkeycloak-remote

mvn -f service-springboot-rest spring-boot:run >/dev/null&
run_tests app-springboot -Pspring-boot
Expand Down
39 changes: 5 additions & 34 deletions scripts/start-local-server.sh
Original file line number Diff line number Diff line change
@@ -1,37 +1,8 @@
#!/bin/bash
#!/bin/bash -e

function waitForServer {
dist=$1
echo -n "Starting $dist"
# Give the server some time to start up. Look for a well-known
# bit of text in the log file. Try at most 50 times before giving up.
C=50
while :
do
grep "$dist .* (WildFly Core .*) started" keycloak.log
if [ $? -eq 0 ]; then
echo " server started."
break
elif [ $C -gt 0 ]; then
echo -n "."
C=$((C-1))
sleep 1
else
echo " timeout!"
cat keycloak.log
exit 1
fi
done
}
export KEYCLOAK_ADMIN=admin
export KEYCLOAK_ADMIN_PASSWORD=admin

if [ -n "$PRODUCT" ] && [ "$PRODUCT" == "true" ]; then
"$PRODUCT_DIST/bin/standalone.sh" -Djava.net.preferIPv4Stack=true -Djboss.socket.binding.port-offset=100 > keycloak.log 2>&1 &
waitForServer "Red Hat Single Sign-On"
else
# GitHub Actions don't preserve file permissions when downloading artifacts
chmod +x keycloak-dist/bin/standalone.sh
keycloak-dist/bin/kc.sh start-dev --http-port=8180 --http-relative-path="/auth" > keycloak.log 2>&1 &

# Start the server
keycloak-dist/bin/standalone.sh -Djava.net.preferIPv4Stack=true -Djboss.socket.binding.port-offset=100 > keycloak.log 2>&1 &
waitForServer "Keycloak"
fi
wget --retry-connrefused --waitretry=1 --read-timeout=20 --timeout=15 -t 30 http://localhost:8180/auth