Build Configured Cluster VM artifact #45
Workflow file for this run
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
#Copyright (c) 2021 Oracle and/or its affiliates. | |
#Released under the Universal Permissive License v1.0 as shown at | |
# https://oss.oracle.com/licenses/upl/ | |
name: Build Configured Cluster VM artifact | |
on: | |
repository_dispatch: | |
types: [vms-configured-cluster-package] | |
workflow_dispatch: | |
inputs: | |
pidType: | |
description: 'Specify which pids to use, oracle or microsoft.' | |
required: true | |
default: 'microsoft' | |
ref: | |
description: 'Specify Git Ref if needed.' | |
required: false | |
default: 'refs/heads/main' | |
# Sample cURL | |
# curl --verbose -X POST https://api.github.com/repos/<github_user>/weblogic-azure/dispatches -H 'Accept: application/vnd.github.everest-preview+json' -H 'Authorization: token <personal_access_token>' --data '{"event_type": "vms-configured-cluster-package", "client_payload": {"pidType": "microsoft", "ref": "refs/heads/main"} }' | |
env: | |
offerName: "arm-oraclelinux-wls-cluster" | |
repoName: "weblogic-azure" | |
repoOwner: ${{ secrets.USER_NAME }} | |
jobs: | |
package: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Setup environment variables | |
id: setup-env-variables-based-on-dispatch-event | |
run: | | |
if [ ${{ github.event_name }} == 'workflow_dispatch' ]; then | |
pidType=${{ github.event.inputs.pidType }} | |
ref=${{ github.event.inputs.ref }} | |
else | |
pidType=${{ github.event.client_payload.pidType }} | |
ref=${{ github.event.client_payload.ref }} | |
fi | |
if [ -z "$pidType" ]; then | |
pidType='microsoft' | |
fi | |
if [ -z "$ref" ]; then | |
ref='refs/heads/main' | |
fi | |
echo "##[set-output name=pidType;]${pidType}" | |
echo "##[set-output name=ref;]${ref}" | |
echo "pidType=${pidType}" >> $GITHUB_ENV | |
echo "ref=${ref}" >> $GITHUB_ENV | |
- uses: actions/checkout@v2.3.4 | |
- name: Set dependency reference | |
uses: ./.github/actions/setvars | |
with: | |
varFilePath: ./.github/variables/vm-dependencies.env | |
- name: Checkout azure-javaee-iaas | |
uses: actions/checkout@v2 | |
with: | |
repository: Azure/azure-javaee-iaas | |
path: azure-javaee-iaas | |
ref: ${{ env.refJavaee }} | |
- name: Download arm-ttk used in partner center pipeline | |
run: | | |
wget -O arm-template-toolkit.zip https://aka.ms/arm-ttk-azureapps | |
unzip arm-template-toolkit.zip -d arm-ttk | |
- name: Checkout ${{ env.repoName }} | |
uses: actions/checkout@v2 | |
with: | |
path: ${{ env.repoName }} | |
ref: ${{ env.ref }} | |
- name: Set up Apache Maven and JDK | |
uses: actions/setup-java@v1 | |
with: | |
java-version: 1.8 | |
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml | |
server-username: MAVEN_USERNAME # env variable for username | |
server-password: MAVEN_TOKEN # env variable for token | |
- name: Set Maven env | |
env: | |
MAVEN_USERNAME: github | |
MAVEN_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
echo "MAVEN_USERNAME=${MAVEN_USERNAME}" >> $GITHUB_ENV | |
echo "MAVEN_TOKEN=${MAVEN_TOKEN}" >> $GITHUB_ENV | |
- name: Update utilities path location | |
run: | | |
cd ${{env.repoName}}/weblogic-azure-vm/${{ env.offerName }} | |
find . -name "*.json" | xargs sed -i 's|../../../../../utilities|../utilities|g' $1 | |
- name: Build and test ${{ env.offerName }} using ${{ env.pidType }} pids | |
run: | | |
cd ${{env.repoName}}/weblogic-azure-vm/${{ env.offerName }}/${{ env.offerName }} | |
pidType=${{ env.pidType }} | |
if [[ "${pidType}" == "oracle" ]];then | |
echo "using oracle pid" | |
mvn -Ptemplate-validation-tests clean install -Dgit.repo.owner=${{ env.repoOwner }} -Dgit.tag=${{ env.ref }} | |
else | |
echo "using ms pid" | |
mvn -Ptemplate-validation-tests clean install -Ddev -Dgit.repo.owner=${{ env.repoOwner }} -Dgit.tag=${{ env.ref }} | |
fi | |
- name: Generate artifact file name and path | |
id: artifact_file | |
run: | | |
version=$(mvn -q -Dexec.executable=echo -Dexec.args='${version.${{ env.offerName }}}' --file weblogic-azure/pom.xml --non-recursive exec:exec) | |
cd ${{env.repoName}}/weblogic-azure-vm/${{ env.offerName }}/${{ env.offerName }} | |
artifactName=${{ env.offerName }}-$version-arm-assembly | |
unzip target/$artifactName.zip -d target/$artifactName | |
echo "##[set-output name=artifactName;]${artifactName}-${{ env.pidType }}" | |
echo "##[set-output name=artifactPath;]${{env.repoName}}/weblogic-azure-vm/${{ env.offerName }}/${{ env.offerName }}/target/$artifactName" | |
- name: Archive ${{ env.offerName }} template | |
uses: actions/upload-artifact@v1 | |
if: success() | |
with: | |
name: ${{steps.artifact_file.outputs.artifactName}} | |
path: ${{steps.artifact_file.outputs.artifactPath}} | |