Skip to content

Commit

Permalink
Refactor WLS on AKS pipeline to reuse DB and Storage Account
Browse files Browse the repository at this point in the history
Signed-off-by: Zheng Chang <zhengchang@microsoft.com>
  • Loading branch information
Zheng Chang authored and edburns committed Nov 3, 2021
1 parent 4db4ac4 commit 5b54d00
Show file tree
Hide file tree
Showing 5 changed files with 127 additions and 356 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/buildWlsAksArtifact.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ name: Build WLS on AKS artifact
on:
workflow_dispatch:
repository_dispatch:
types: [build-zip]
types: [aks-package]
# Sample cURL
# curl --verbose -X POST https://api.github.com/repos/mriccell/weblogic-azure/dispatches -H 'Accept: application/vnd.github.everest-preview+json' -H 'Authorization: token <personal_access_token>' --data '{"event_type": "aks-package"}'

env:
refJavaee: 1a21a792d6bae6768b155945cf2703c3026ac691
Expand Down Expand Up @@ -39,7 +41,7 @@ jobs:
with:
path: weblogic-azure
- name: Build and test weblogic-azure/weblogic-azure-aks
run: mvn -Pbicep -Ddev -Passembly clean install --file weblogic-azure/weblogic-azure-aks/pom.xml
run: mvn -Pbicep -Passembly clean install --file weblogic-azure/weblogic-azure-aks/pom.xml
- name: Generate artifact file name and path
id: artifact_file
run: |
Expand Down
119 changes: 119 additions & 0 deletions .github/workflows/setupWlsAksDependency.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
name: Setup DB and Storage Account

on:
workflow_dispatch:
# Sample cURL
# curl --verbose -X POST https://api.github.com/repos/mriccell/weblogic-azure/dispatches -H 'Accept: application/vnd.github.everest-preview+json' -H 'Authorization: token <personal_access_token>' --data '{"event_type": "aks-deploy-dependency"}'
repository_dispatch:
types: [aks-deploy-dependency]

env:
azCliVersion: 2.29.0
azureCredentials: ${{ secrets.AZURE_CREDENTIALS }}
location: eastus
dbAdminUser: weblogic
dbPassword: ${{ secrets.DB_PASSWORD }}
dbName: wlsdb${{ github.run_id }}${{ github.run_number }}
aksRepoUserName: oracle
aksRepoBranchName: main
resourceGroupForDB: wlsd-db-${{ github.run_id }}-${{ github.run_number }}
resourceGroupForStorageAccount: wlsd-sa-${{ github.run_id }}-${{ github.run_number }}
storageAccountName: wlsdsa${{ github.run_id }}${{ github.run_number }}
storageContainerName: wlsdcon${{ github.run_id }}${{ github.run_number }}

jobs:
preflight:
runs-on: ubuntu-latest
steps:
- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
deploy-db:
needs: preflight
runs-on: ubuntu-latest
steps:
- uses: azure/login@v1
id: azure-login
with:
creds: ${{ env.azureCredentials }}
- name: Create Resource Group
uses: azure/CLI@v1
with:
azcliversion: ${{ env.azCliVersion }}
inlineScript: |
echo "create resource group" ${{ env.resourceGroupForDB }}
az group create --verbose --name ${{ env.resourceGroupForDB }} --location ${{ env.location }}
- name: Set Up Azure Postgresql to Test dbTemplate
id: setup-postgresql
uses: azure/CLI@v1
with:
azcliversion: ${{ env.azCliVersion }}
inlineScript: |
echo "Deploy DB with name " ${{ env.dbName }}
az postgres server create \
--resource-group ${{ env.resourceGroupForDB }} \
--name ${{ env.dbName }} \
--location ${{ env.location }} \
--admin-user ${{ env.dbAdminUser }} \
--ssl-enforcement Enabled \
--public-network-access Enabled \
--admin-password ${{ env.dbPassword }} \
--sku-name B_Gen5_1
echo "Allow Access To Azure Services"
az postgres server firewall-rule create \
-g ${{ env.resourceGroupForDB }} \
-s ${{ env.dbName }} \
-n "AllowAllWindowsAzureIps" \
--start-ip-address "0.0.0.0" \
--end-ip-address "0.0.0.0"
deploy-storage-account:
needs: preflight
runs-on: ubuntu-latest
steps:
- uses: azure/login@v1
id: azure-login
with:
creds: ${{ env.azureCredentials }}
- name: Create Resource Group
uses: azure/CLI@v1
with:
azcliversion: ${{ env.azCliVersion }}
inlineScript: |
echo "create resource group" ${{ env.resourceGroupForStorageAccount }}
az group create --verbose --name ${{ env.resourceGroupForStorageAccount }} --location ${{ env.location }}
- name: Create Storage Account
uses: azure/CLI@v1
with:
azcliversion: ${{ env.azCliVersion }}
inlineScript: |
az storage account create --name ${{ env.storageAccountName }} \
--resource-group ${{ env.resourceGroupForStorageAccount }} \
--location ${{ env.location }} \
--sku Standard_LRS \
--kind StorageV2
- name: Create Storage Container
uses: azure/CLI@v1
with:
azcliversion: ${{ env.azCliVersion }}
inlineScript: |
az storage container create -n ${{ env.storageContainerName }} --public-access container --account-name ${{ env.storageAccountName }}
format-db-sa-parameters-for-integration-test:
needs: [deploy-storage-account, deploy-db]
runs-on: ubuntu-latest
steps:
- name: Generate integration-test parameter json
id: artifact_file
run: |
cat <<EOF >integration-test-data.txt
# sample request
curl --verbose -X POST https://api.github.com/repos/mriccell/weblogic-azure/dispatches -H 'Accept: application/vnd.github.everest-preview+json' -H 'Authorization: token <personal_access_token>' --data '<request_data>'
# copy the JSON as <request_data>
{"event_type": "aks-integration-test-without-dependency-creation", "client_payload": {"isForDemo": "false", "disambiguationSuffix": "${{ github.run_id }}", "storageAccountName": "${{ env.storageAccountName }}", "storageContainerName": "${{ env.storageContainerName }}", "dbName": "${{ env.dbName }}"}}
EOF
- name: Archive integration-test-data.txt
uses: actions/upload-artifact@v1
if: success()
with:
name: integration-test-data
path: integration-test-data.txt
7 changes: 4 additions & 3 deletions .github/workflows/syncupWithUpstream.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
name: Merge upstream branches
name: Merge upstream branches for WLS on AKS
on:
workflow_dispatch:
# Sample cURL
# curl --verbose -X POST https://api.github.com/repos/mriccell/weblogic-azure/dispatches -H 'Accept: application/vnd.github.everest-preview+json' -H 'Authorization: token <personal_access_token>' --data '{"event_type": "aks-upstream-sync"}'
repository_dispatch:
types: [upstream-sync]
types: [aks-upstream-sync]
env:
userName: ${{ secrets.USER_NAME }}
userEmail: ${{ secrets.USER_EMAIL }}
gitToken: ${{ secrets.GIT_TOKEN }}
jobs:
merge:
if: (github.event_name == 'schedule' && github.repository_owner == 'mriccell') || (github.event_name != 'schedule')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
Expand Down
Loading

0 comments on commit 5b54d00

Please sign in to comment.