Build Admin Server VM artifact #62
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. | |
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl. | |
name: Build Admin Server VM artifact | |
on: | |
repository_dispatch: | |
types: [vms-admin-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-admin-package", "client_payload": {"pidType": "microsoft", "ref": "refs/heads/main"}}' | |
env: | |
offerName: "arm-oraclelinux-wls-admin" | |
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/[email protected] | |
- name: Set up Maven with GitHub token | |
uses: ./.github/actions/setupmaven | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- uses: actions/[email protected] | |
- name: Set dependency reference | |
uses: ./.github/actions/setvars | |
with: | |
varFilePath: ./.github/variables/vm-dependencies.env | |
- 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: 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 }} | |
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 }} | |
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 }}/target/$artifactName" | |
- name: Archive ${{ env.offerName }} template | |
uses: actions/upload-artifact@v4 | |
if: success() | |
with: | |
name: ${{steps.artifact_file.outputs.artifactName}} | |
path: ${{steps.artifact_file.outputs.artifactPath}} | |