Skip to content

Manual Pre-Daily Build Action #6

Manual Pre-Daily Build Action

Manual Pre-Daily Build Action #6

name: Manual Pre-Daily Build Action
on:
workflow_dispatch:
inputs:
date:
description: Dev date as 2023-07-11_0401
required: true
build_level:
description: Build level as cl230720230711-0401
required: true
driver_location:
description: Driver location like openliberty-all-23.0.0.7-cl230720230711-0401.zip
required: true
env:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
LIBERTY_LICENSE_SHA: ${{ secrets.LIBERTY_LICENSE_SHA }}
jobs:
build-docker-image:
runs-on: ubuntu-latest
env:
DHE_URL: https://public.dhe.ibm.com/ibmdl/export/pub/software/openliberty/runtime/nightly
steps:
- name: Clone ci.docker repository
uses: actions/checkout@v2
with:
repository: OpenLiberty/ci.docker
path: ci.docker
- name: Docker login
run: echo $DOCKER_PASSWORD | docker login -u $DOCKER_USERNAME --password-stdin
- name: Build Docker image for ${{ github.event.inputs.date }}
run: |
cd ci.docker/releases/latest/full
sed -i "s;wget -q \$LIBERTY_DOWNLOAD_URL;wget $DHE_URL/${{ github.event.inputs.date }}/${{ github.event.inputs.driver_location }};g" Dockerfile.ubi.openjdk11
sed -i '/&& sha1sum/d' Dockerfile.ubi.openjdk11
cat Dockerfile.ubi.openjdk11
echo "Building ${{ github.event.inputs.build_level }} from ${{ github.event.inputs.date }}"
docker build --build-arg LIBERTY_LICENSE_SHA=$LIBERTY_LICENSE_SHA -q -t $DOCKER_USERNAME/olguides:${{ github.event.inputs.build_level }} -f Dockerfile.ubi.openjdk11 .
docker push $DOCKER_USERNAME/olguides:${{ github.event.inputs.build_level }}
- name: Build Java 17 Docker image for ${{ github.event.inputs.date }}
run: |
cd ci.docker/releases/latest/full
sed -i "s;wget -q \$LIBERTY_DOWNLOAD_URL;wget $DHE_URL/${{ github.event.inputs.date }}/${{ github.event.inputs.driver_location }};g" Dockerfile.ubi.openjdk17
sed -i '/&& sha1sum/d' Dockerfile.ubi.openjdk17
cat Dockerfile.ubi.openjdk17
echo "Building Java 17 ${{ github.event.inputs.build_level }} from ${{ github.event.inputs.date }}"
docker build --build-arg LIBERTY_LICENSE_SHA=$LIBERTY_LICENSE_SHA -q -t $DOCKER_USERNAME/olguides:${{ github.event.inputs.build_level }}-java17 -f Dockerfile.ubi.openjdk17 .
docker push $DOCKER_USERNAME/olguides:${{ github.event.inputs.build_level }}-java17
trigger-builds:
runs-on: ubuntu-latest
needs: [ build-docker-image ]
env:
GH_TOKEN: ${{ secrets.ADMIN_TOKEN }}
URI: "https://api.github.com/repos/OpenLiberty/guides-common/dispatches"
ACCEPT_HEADER: "application/vnd.github.v3+json"
CONTENT_TYPE: "application/json"
PAYLOAD: '{ "dev-date": "${{ github.event.inputs.date }}", "driver-location": "${{ github.event.inputs.driver_location }}", "build-level": "${{ github.event.inputs.build_level }}", "jdk": "11" }'
steps:
- name: Trigger daily builds
run: |
curl -H "Accept: $ACCEPT_HEADER" \
-H "Authorization: token $GH_TOKEN" \
-d "{ \"event_type\": \"manual-daily-build\", \"client_payload\": $PAYLOAD }" \
-X POST $URI
- name: Trigger daily builds for Java 17
run: |
curl -H "Accept: $ACCEPT_HEADER" \
-H "Authorization: token $GH_TOKEN" \
-d "{ \"event_type\": \"manual-daily-build-java17\", \"client_payload\": $PAYLOAD }" \
-X POST $URI