-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[WFLY-18470] Enhancement and update of ejb-txn-remote-call
- Loading branch information
Showing
35 changed files
with
1,476 additions
and
762 deletions.
There are no files selected for viewing
116 changes: 116 additions & 0 deletions
116
...openshift-ci/build-root/scripts/qs-overrides/ejb-txn-remote-call/overridable-functions.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,116 @@ | ||
# These functions are 'overridable in the individual quickstarts. | ||
# To do so create a ./qs-overrides/${qs_dir}/overridable-functions.sh and override the | ||
# functions you need to. ${qs_dir} in this case is the same as the name of the quickstart directory | ||
# that you want to tweak | ||
|
||
# Installs any prerequisites before doing the Helm install. | ||
# The current directory is the quickstart directory. | ||
# The default is to use the quickstart directory as the name, but in some cases | ||
# a quickstart may need to shorten the name of the application in order to control | ||
# the length of the resources created by OpenShift | ||
# | ||
# Parameters | ||
# 1 - the name of the qs directory (not the full path) | ||
function applicationName() { | ||
#echo "${1}" | ||
# The fill microprofile-reactive-messaging-kafka name results in names of generated resources which are too long for | ||
# OpenShift to handle | ||
echo "ejb-txn-remote-call" | ||
} | ||
|
||
|
||
# Installs any prerequisites before doing the Helm install. | ||
# The current directory is the quickstart directory | ||
# | ||
# Parameters | ||
# 1 - application name | ||
function installPrerequisites() | ||
{ | ||
application="${1}" | ||
|
||
CURRENT_FOLDER=$(pwd) | ||
|
||
echo "Installing the PostgreSQL database" | ||
|
||
# Install bitnami and PostgreSQL | ||
helm repo add bitnami https://charts.bitnami.com/bitnami | ||
helm install postgresql bitnami/postgresql -f charts/postgresql.yaml --wait --timeout="${helm_install_timeout}" | ||
|
||
echo "Cloning WildFly operator repository in /tmp" | ||
|
||
cd /tmp || return | ||
git clone https://github.com/wildfly/wildfly-operator.git | ||
|
||
cd wildfly-operator || return | ||
|
||
echo "Installing and deploying the 'WildFly operator' to the cluster" | ||
|
||
oc adm policy add-cluster-role-to-user cluster-admin developer | ||
make install || return | ||
make deploy || return | ||
|
||
seconds=120 | ||
now=$(date +%s) | ||
end=$(($seconds + $now)) | ||
|
||
echo "Waiting for 2 minutes that the 'WildFly operator' pod is in the 'Running' status." | ||
while [ $now -lt $end ]; do | ||
sleep 5 | ||
|
||
if [[ $(oc get pods --field-selector=status.phase==Running -l name=wildfly-operator | awk '{ if ($3 == "Running" && $2 == "1/1") { print } }') ]]; then | ||
break | ||
fi | ||
|
||
now=$(date +%s) | ||
done | ||
|
||
cd $CURRENT_FOLDER || return | ||
} | ||
|
||
function helmInstall() { | ||
helm_set_arguments="$2" | ||
|
||
# TODO https://issues.redhat.com/browse/WFLY-18574 remove this when persistence is working | ||
# This seems to work with my postgresql.yaml :fingers_crossed | ||
# helm_set_arguments="${helm_set_arguments} --set postgresql.primary.persistence.enabled=false" | ||
|
||
# Don't quote ${helm_set_arguments} as it breaks the command when empty, and seems to work without | ||
helm install client -f charts/client.yaml wildfly/wildfly --wait --timeout="${helm_install_timeout}" ${helm_set_arguments} | ||
echo "$?" | ||
# TODO: should we check when the build is done? | ||
helm install server -f charts/server.yaml wildfly/wildfly --wait --timeout="${helm_install_timeout}" ${helm_set_arguments} | ||
echo "$?" | ||
# TODO: should we check when the build is done? | ||
} | ||
|
||
# Commands to run once the Helm install has completed | ||
function runPostHelmInstallCommands() { | ||
|
||
# Make sure that view permissions are granted to the default system account. | ||
oc policy add-role-to-user view system:serviceaccount:$(oc project -q):default -n $(oc project -q) | ||
|
||
oc create -f client/client-cr.yaml | ||
# TODO: should we check when the deployment is completed? | ||
oc create -f server/server-cr.yaml | ||
# TODO: should we check when the deployment is completed? | ||
} | ||
|
||
# Cleans any prerequisites after doing the Helm uninstall. | ||
# The current directory is the quickstart directory | ||
# | ||
# Parameters | ||
# 1 - application name | ||
function cleanPrerequisites() | ||
{ | ||
cd /tmp/wildfly-operator || return | ||
|
||
make undeploy | ||
make uninstall | ||
|
||
cd .. | ||
rm -rf wildfly-operator | ||
|
||
# Uninstall PostgreSQL and remove bitnami | ||
helm uninstall postgresql | ||
helm repo remove bitnami | ||
} |
237 changes: 237 additions & 0 deletions
237
.github/workflows/quickstart_ejb-txn-remote-call_ci.yml
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,237 @@ | ||
name: WildFly ejb-txn-remote-call Quickstart CI | ||
|
||
on: | ||
pull_request: | ||
types: [opened, synchronize, reopened, ready_for_review] | ||
paths: | ||
- 'ejb-txn-remote-call/**' | ||
- .github/workflows/quickstart_ci.yml | ||
|
||
# Only run the latest job | ||
concurrency: | ||
group: '${{ github.workflow }} @ ${{ github.ref || github.run_id }}' | ||
cancel-in-progress: true | ||
|
||
env: | ||
QUICKSTART_PATH: ejb-txn-remote-call | ||
TEST_PROVISIONED_SERVER: true | ||
TEST_BOOTABLE_JAR: false | ||
TEST_OPENSHIFT: true | ||
MATRIX_JDK: '"11", "17"' | ||
MATRIX_OS: '"ubuntu-latest"' | ||
SERVER_PROVISIONING_SERVER_HOST: 'http://localhost' | ||
|
||
jobs: | ||
Matrix-Setup: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
os: ${{ steps.setup-matrix-os.outputs.os }} | ||
jdk: ${{ steps.setup-matrix-jdk.outputs.jdk }} | ||
steps: | ||
- id: setup-matrix-jdk | ||
run: echo 'jdk=[${{ env.MATRIX_JDK }}]' >> $GITHUB_OUTPUT | ||
- id: setup-matrix-os | ||
run: echo 'os=[${{ env.MATRIX_OS }}]' >> $GITHUB_OUTPUT | ||
|
||
Test-build-default-matrix: | ||
name: BUILD DEFAULT - JDK${{ matrix.jdk }} - ${{ matrix.os }} | ||
runs-on: ${{ matrix.os }} | ||
needs: Matrix-Setup | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
jdk: ${{ fromJSON(needs.Matrix-Setup.outputs.jdk) }} | ||
os: ${{ fromJSON(needs.Matrix-Setup.outputs.os) }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
path: quickstarts | ||
- name: Set up JDK ${{ matrix.jdk }} | ||
uses: actions/setup-java@v4 | ||
with: | ||
java-version: ${{ matrix.jdk }} | ||
distribution: 'temurin' | ||
cache: 'maven' | ||
- name: Run before script | ||
env: | ||
FILE: "./quickstarts/.github/workflows/quickstart_${{ env.QUICKSTART_PATH }}_ci_before.sh" | ||
run: | | ||
if test -f $FILE; | ||
then | ||
chmod +x $FILE | ||
bash $FILE | ||
fi | ||
shell: bash | ||
- name: Build ${{ env.QUICKSTART_PATH }} Quickstart for Release | ||
run: | | ||
cd quickstarts | ||
cd ${{ env.QUICKSTART_PATH }} | ||
mvn -fae clean install -Drelease | ||
shell: bash | ||
- name: Build, run & test ${{ env.QUICKSTART_PATH }} Quickstart with provisioned-server profile | ||
if: ${{ env.TEST_PROVISIONED_SERVER }} | ||
run: | | ||
cd quickstarts | ||
cd ${{ env.QUICKSTART_PATH }}/client | ||
echo "Building 'client' provisioned server..." | ||
mvn -fae clean package -Pprovisioned-server -DremoteServerUsername="quickstartUser" -DremoteServerPassword="quickstartPwd1!" -DpostgresqlUsername="test" -DpostgresqlPassword="test" | ||
mvn wildfly:start -Djboss-as.home=target/server -Dwildfly.javaOpts="-Djboss.tx.node.id=server1 -Djboss.node.name=server1" -Dstartup-timeout=120 | ||
cd ../server | ||
echo "Building 'server' provisioned server..." | ||
mvn -fae clean package -Pprovisioned-server -Dwildfly.provisioning.dir=server2 -Djboss-as.home=target/server2 -DpostgresqlUsername="test" -DpostgresqlPassword="test" | ||
mvn -fae package -Pprovisioned-server -Dwildfly.provisioning.dir=server3 -Djboss-as.home=target/server3 -DpostgresqlUsername="test" -DpostgresqlPassword="test" | ||
echo "Add quickstartUser to both 'server' builds..." | ||
./target/server2/bin/add-user.sh -a -u 'quickstartUser' -p 'quickstartPwd1!' -g 'guest,user,JBossAdmin,Users' | ||
./target/server3/bin/add-user.sh -a -u 'quickstartUser' -p 'quickstartPwd1!' -g 'guest,user,JBossAdmin,Users' | ||
echo "Add quickstartAdmin to both 'server' builds..." | ||
./target/server2/bin/add-user.sh -a -u 'quickstartAdmin' -p 'adminPwd1!' -g 'guest,user,admin' | ||
./target/server2/bin/add-user.sh -a -u 'quickstartAdmin' -p 'adminPwd1!' -g 'guest,user,admin' | ||
echo "Starting provisioned server..." | ||
mvn wildfly:start -Djboss-as.home=target/server2 -Dwildfly.port=10090 -Dwildfly.serverConfig=standalone-ha.xml -Dwildfly.javaOpts="-Djboss.socket.binding.port-offset=100 -Djboss.tx.node.id=server2 -Djboss.node.name=server2" -Dstartup-timeout=120 | ||
mvn wildfly:start -Djboss-as.home=target/server3 -Dwildfly.port=10190 -Dwildfly.serverConfig=standalone-ha.xml -Dwildfly.javaOpts="-Djboss.socket.binding.port-offset=200 -Djboss.tx.node.id=server3 -Djboss.node.name=server3" -Dstartup-timeout=120 | ||
echo "Testing provisioned server..." | ||
cd ../client | ||
mvn -fae verify -Dserver.host=${{ env.SERVER_PROVISIONING_SERVER_HOST }}:8080 -Pintegration-testing | ||
cd ../server | ||
mvn -fae verify -Dserver.host=${{ env.SERVER_PROVISIONING_SERVER_HOST }}:8180 -Pintegration-testing | ||
mvn -fae verify -Dserver.host=${{ env.SERVER_PROVISIONING_SERVER_HOST }}:8280 -Pintegration-testing | ||
echo "Shutting down provisioned server..." | ||
cd ../client | ||
mvn wildfly:shutdown | ||
cd ../server | ||
mvn wildfly:shutdown -Dwildfly.port=10090 | ||
mvn wildfly:shutdown -Dwildfly.port=10190 | ||
shell: bash | ||
- name: Build ${{ env.QUICKSTART_PATH }} Quickstart with openshift profile | ||
if: ${{ env.TEST_OPENSHIFT }} | ||
run: | | ||
cd quickstarts | ||
cd ${{ env.QUICKSTART_PATH }}/client | ||
mvn -fae clean package -Popenshift -DremoteServerUsername="quickstartUser" -DremoteServerPassword="quickstartPwd1!" -DpostgresqlUsername="test" -DpostgresqlPassword="test" | ||
cd ../server | ||
mvn -fae clean package -Popenshift -DpostgresqlUsername="test" -DpostgresqlPassword="test" | ||
shell: bash | ||
- name: Run after script | ||
env: | ||
FILE: "./quickstarts/.github/workflows/quickstart_${{ env.QUICKSTART_PATH }}_ci_after.sh" | ||
run: | | ||
if test -f $FILE; | ||
then | ||
chmod +x $FILE | ||
bash $FILE | ||
fi | ||
shell: bash | ||
- uses: actions/upload-artifact@v4 | ||
if: failure() | ||
with: | ||
name: surefire-reports-JDK${{ matrix.jdk }}-${{ matrix.os }} | ||
path: 'quickstarts/${{ env.QUICKSTART_PATH }}/**/surefire-reports/*.txt' | ||
|
||
# Use the shared-wildfly-build workflow to have a consistent WildFly build. Note the branch names MUST match what | ||
# is used in WildFly. | ||
WildFly-build: | ||
uses: wildfly/wildfly/.github/workflows/shared-wildfly-build.yml@main | ||
with: | ||
wildfly-branch: ${{ github.base_ref }} | ||
wildfly-repo: "wildfly/wildfly" | ||
|
||
Test-build-with-deps-matrix: | ||
name: BUILD WITH DEPS - JDK${{ matrix.jdk }} - ${{ matrix.os }} | ||
runs-on: ${{ matrix.os }} | ||
needs: [Matrix-Setup, WildFly-build] | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
jdk: ${{ fromJSON(needs.Matrix-Setup.outputs.jdk) }} | ||
os: ${{ fromJSON(needs.Matrix-Setup.outputs.os) }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
path: quickstarts | ||
- uses: actions/download-artifact@v4 | ||
with: | ||
name: wildfly-maven-repository | ||
path: . | ||
- name: Extract Maven Repo | ||
shell: bash | ||
run: tar -xzf wildfly-maven-repository.tar.gz -C ~ | ||
- name: Set up JDK ${{ matrix.jdk }} | ||
uses: actions/setup-java@v4 | ||
with: | ||
java-version: ${{ matrix.jdk }} | ||
distribution: 'temurin' | ||
cache: 'maven' | ||
- name: Run before script | ||
env: | ||
FILE: "./quickstarts/.github/workflows/quickstart_${{ env.QUICKSTART_PATH }}_ci_before.sh" | ||
run: | | ||
if test -f $FILE; | ||
then | ||
chmod +x $FILE | ||
bash $FILE | ||
fi | ||
shell: bash | ||
- name: Build Quickstart for Release with built Server version | ||
run: | | ||
cd quickstarts | ||
cd ${{ env.QUICKSTART_PATH }} | ||
mvn -fae clean package -Drelease -Dversion.server=${{ needs.wildfly-build.outputs.wildfly-version }} | ||
shell: bash | ||
- name: Build, run & test ${{ env.QUICKSTART_PATH }} Quickstart with provisioned-server profile, and built Server version | ||
if: ${{ env.TEST_PROVISIONED_SERVER }} | ||
run: | | ||
cd quickstarts | ||
cd ${{ env.QUICKSTART_PATH }}/client | ||
echo "Building 'client' provisioned server..." | ||
mvn -fae clean package -Pprovisioned-server -DremoteServerUsername="quickstartUser" -DremoteServerPassword="quickstartPwd1!" -DpostgresqlUsername="test" -DpostgresqlPassword="test" -Dversion.server=${{ needs.wildfly-build.outputs.wildfly-version }} | ||
mvn wildfly:start -Djboss-as.home=target/server -Dwildfly.javaOpts="-Djboss.tx.node.id=server1 -Djboss.node.name=server1" -Dstartup-timeout=120 | ||
cd ../server | ||
echo "Building 'server' provisioned server..." | ||
mvn -fae clean package -Pprovisioned-server -Dwildfly.provisioning.dir=server2 -Djboss-as.home=target/server2 -DpostgresqlUsername="test" -DpostgresqlPassword="test" -Dversion.server=${{ needs.wildfly-build.outputs.wildfly-version }} | ||
mvn -fae package -Pprovisioned-server -Dwildfly.provisioning.dir=server3 -Djboss-as.home=target/server3 -DpostgresqlUsername="test" -DpostgresqlPassword="test" -Dversion.server=${{ needs.wildfly-build.outputs.wildfly-version }} | ||
echo "Add quickstartUser to both 'server' builds..." | ||
./target/server2/bin/add-user.sh -a -u 'quickstartUser' -p 'quickstartPwd1!' -g 'guest,user,JBossAdmin,Users' | ||
./target/server3/bin/add-user.sh -a -u 'quickstartUser' -p 'quickstartPwd1!' -g 'guest,user,JBossAdmin,Users' | ||
echo "Add quickstartAdmin to both 'server' builds..." | ||
./target/server2/bin/add-user.sh -a -u 'quickstartAdmin' -p 'adminPwd1!' -g 'guest,user,admin' | ||
./target/server2/bin/add-user.sh -a -u 'quickstartAdmin' -p 'adminPwd1!' -g 'guest,user,admin' | ||
echo "Starting provisioned server..." | ||
mvn wildfly:start -Djboss-as.home=target/server2 -Dwildfly.port=10090 -Dwildfly.serverConfig=standalone-ha.xml -Dwildfly.javaOpts="-Djboss.socket.binding.port-offset=100 -Djboss.tx.node.id=server2 -Djboss.node.name=server2" -Dstartup-timeout=120 | ||
mvn wildfly:start -Djboss-as.home=target/server3 -Dwildfly.port=10190 -Dwildfly.serverConfig=standalone-ha.xml -Dwildfly.javaOpts="-Djboss.socket.binding.port-offset=200 -Djboss.tx.node.id=server3 -Djboss.node.name=server3" -Dstartup-timeout=120 | ||
echo "Testing provisioned server..." | ||
cd ../client | ||
mvn -fae verify -Dserver.host=${{ env.SERVER_PROVISIONING_SERVER_HOST }}:8080 -Pintegration-testing | ||
cd ../server | ||
mvn -fae verify -Dserver.host=${{ env.SERVER_PROVISIONING_SERVER_HOST }}:8180 -Pintegration-testing | ||
mvn -fae verify -Dserver.host=${{ env.SERVER_PROVISIONING_SERVER_HOST }}:8280 -Pintegration-testing | ||
echo "Shutting down provisioned server..." | ||
cd ../client | ||
mvn wildfly:shutdown | ||
cd ../server | ||
mvn wildfly:shutdown -Dwildfly.port=10090 | ||
mvn wildfly:shutdown -Dwildfly.port=10190 | ||
shell: bash | ||
- name: Build ${{ env.QUICKSTART_PATH }} Quickstart with openshift profile, and built Server version | ||
if: ${{ env.TEST_OPENSHIFT }} | ||
run: | | ||
cd quickstarts | ||
cd ${{ env.QUICKSTART_PATH }}/client | ||
mvn -fae clean package -Popenshift -DremoteServerUsername="quickstartUser" -DremoteServerPassword="quickstartPwd1!" -DpostgresqlUsername="test" -DpostgresqlPassword="test" -Dversion.server=${{ needs.wildfly-build.outputs.wildfly-version }} | ||
cd ../server | ||
mvn -fae clean package -Popenshift -DpostgresqlUsername="test" -DpostgresqlPassword="test" -Dversion.server=${{ needs.wildfly-build.outputs.wildfly-version }} | ||
shell: bash | ||
- name: Run after script | ||
env: | ||
FILE: "./quickstarts/.github/workflows/quickstart_${{ env.QUICKSTART_PATH }}_ci_after.sh" | ||
run: | | ||
if test -f $FILE; | ||
then | ||
chmod +x $FILE | ||
bash $FILE | ||
fi | ||
shell: bash | ||
- uses: actions/upload-artifact@v4 | ||
if: failure() | ||
with: | ||
name: surefire-reports-JDK${{ matrix.jdk }}-${{ matrix.os }} | ||
path: 'quickstarts/**/surefire-reports/*.txt' |
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 @@ | ||
docker run -d -p 5432:5432 --rm -ePOSTGRES_DB=test -ePOSTGRES_USER=test -ePOSTGRES_PASSWORD=test postgres:9.4 -c max-prepared-transactions=110 -c log-statement=all |
Oops, something went wrong.