Skip to content

Commit

Permalink
Merge pull request #79 from OpenLiberty/staging
Browse files Browse the repository at this point in the history
Create staging to prod - enable daily build test (#78)
  • Loading branch information
gkwan-ibm authored Jul 24, 2024
2 parents 590dcce + 381f384 commit fead12b
Show file tree
Hide file tree
Showing 4 changed files with 83 additions and 0 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/triggerConversion.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Rebuild cloud-hosted guide

# Controls when the action will run. Triggers the workflow on push
# events but only for the master branch
on:
push:
branches:
- 'prod'
- 'staging'

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "post"
post:
# The type of runner that the job will run on
runs-on: ubuntu-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
# Uses the secrets from the organisation for credentials
- uses: actions/checkout@v2

- name: Invoke workflow in another repo with inputs
uses: benc-uk/workflow-dispatch@v1
with:
workflow: GuideConverterV3
repo: OpenLiberty/cloud-hosted-guides
token: ${{ secrets.GUIDECONVERSIONTOOL_PASSWORD }}
inputs: '{ "branch": "${{ github.ref }}", "guide_name": "${{ github.event.repository.name }}" }'
ref: "refs/heads/prod"
24 changes: 24 additions & 0 deletions scripts/dailyBuild.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash
while getopts t:d:b:u: flag;
do
case "${flag}" in
t) DATE="${OPTARG}";;
d) DRIVER="${OPTARG}";;
b) BUILD="${OPTARG}";;
u) DOCKER_USERNAME="${OPTARG}";;
*) echo "Invalid option";;
esac
done

echo "Testing daily build image"

sed -i "\#<artifactId>liberty-maven-plugin</artifactId>#a<configuration><install><runtimeUrl>https://public.dhe.ibm.com/ibmdl/export/pub/software/openliberty/runtime/nightly/$DATE/$DRIVER</runtimeUrl></install></configuration>" system/pom.xml query/pom.xml
cat system/pom.xml query/pom.xml

if [[ "$DOCKER_USERNAME" != "" ]]; then
sed -i "s;FROM icr.io/appcafe/open-liberty:kernel-slim-java11-openj9-ubi;FROM $DOCKER_USERNAME/olguides:$BUILD;g" system/Dockerfile query/Dockerfile
sed -i "s;RUN features.sh;#RUN features.sh;g" system/Dockerfile query/Dockerfile
cat system/Dockerfile query/Dockerfile
fi

../scripts/testApp.sh
25 changes: 25 additions & 0 deletions scripts/dockerImageTest.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash
while getopts t:d:b:u: flag;
do
case "${flag}" in
t) DATE="${OPTARG}";;
d) DRIVER="${OPTARG}";;
*) echo "Invalid option";;
esac
done

echo "Testing daily Docker image"

sed -i "\#<artifactId>liberty-maven-plugin</artifactId>#a<configuration><install><runtimeUrl>https://public.dhe.ibm.com/ibmdl/export/pub/software/openliberty/runtime/nightly/$DATE/$DRIVER</runtimeUrl></install></configuration>" system/pom.xml query/pom.xml
cat system/pom.xml query/pom.xml

sed -i "s;FROM icr.io/appcafe/open-liberty:kernel-slim-java11-openj9-ubi;FROM cp.stg.icr.io/cp/olc/open-liberty-daily:full-java11-openj9-ubi;g" system/Dockerfile query/Dockerfile
sed -i "s;RUN features.sh;#RUN features.sh;g" system/Dockerfile query/Dockerfile
cat system/Dockerfile query/Dockerfile

echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin cp.stg.icr.io
docker pull "cp.stg.icr.io/cp/olc/open-liberty-daily:full-java11-openj9-ubi"
echo "build level:"
docker inspect --format "{{ index .Config.Labels \"org.opencontainers.image.revision\"}}" cp.stg.icr.io/cp/olc/open-liberty-daily:full-java11-openj9-ubi

../scripts/testApp.sh
3 changes: 3 additions & 0 deletions scripts/testApp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ docker run -d --network=$NETWORK --name query -p 9085:9085 query:1.0-SNAPSHOT

sleep 30

docker logs system | grep Launching
docker logs query | grep Launching

curl http://localhost:9085/query/systems/system

queryStatus="$(curl --write-out "%{http_code}\n" --silent --output /dev/null "http://localhost:9085/query/systems/system")"
Expand Down

0 comments on commit fead12b

Please sign in to comment.