Build Dynamic Cluster VM artifact #44
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 Dynamic Cluster VM artifact | |
on: | |
repository_dispatch: | |
types: [vms-dynamic-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-dynamic-cluster-package", "client_payload": {"pidType": "microsoft", "ref": "refs/heads/main"}}' | |
env: | |
offerName: "arm-oraclelinux-wls-dynamic-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 up Maven with GitHub token | |
uses: ./.github/actions/setupmaven | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- uses: actions/checkout@v2.3.4 | |
- 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 }}/${{ env.offerName }} | |
pidType=${{ env.pidType }} | |
echo ${pidType} | |
if [[ "${pidType}" == "oracle" ]];then | |
echo "using oracle pids" | |
mvn -Ptemplate-validation-tests clean install -Dgit.repo.owner=${{ env.repoOwner }} -Dgit.tag=${{ env.ref }} | |
else | |
echo "using ms pids" | |
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}} |