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

Create staging to prod - enable daily build test (#78) #79

Merged
merged 2 commits into from
Jul 24, 2024
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
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
Loading