Test WLS on AKS with Dependency creation #15
This file contains hidden or 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
name: Test WLS on AKS with Dependency creation | |
run-name: Test WLS on AKS with Dependency creation with `db`:${{ inputs.databaseType }} | |
on: | |
workflow_dispatch: | |
inputs: | |
isForDemo: | |
description: 'If set to true, resources will not be deleted' | |
required: true | |
default: 'false' | |
vmSize: | |
description: 'The VM size for the AKS pool' | |
required: true | |
default: Standard_D2s_v3 | |
location: | |
description: 'The location for the resources' | |
required: true | |
default: centralus | |
databaseType: | |
description: 'Database connection' | |
required: true | |
default: 'postgresql(flexible)' | |
type: choice | |
options: | |
- postgresql(flexible) | |
- postgresql-passwordless(flexible) | |
configurations_for_it: | |
description: "JSON string of environment variables used for IT" | |
required: false | |
default: '{}' | |
# 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": "aks-integration-test-with-dependency-creation", "client_payload": {"isForDemo": "false"}}' | |
repository_dispatch: | |
types: [aks-integration-test-with-dependency-creation,integration-test-all] | |
env: | |
azureCredentials: ${{ secrets.AZURE_CREDENTIALS }} | |
resourceGroupForWlsAks: wlsd-aks-${{ github.run_id }}-${{ github.run_number }} | |
dbAdminUser: weblogic | |
dbPassword: ${{ secrets.DB_PASSWORD }} | |
dbName: wlsdb${{ github.run_id }}${{ github.run_number }} | |
dbServerName: db${{ github.run_id }}${{ github.run_number }} | |
uamiName: uami${{ github.run_id }}${{ github.run_number }} | |
ocrSSOUser: ${{ secrets.ORC_SSOUSER }} | |
ocrSSOPSW: ${{ secrets.ORC_SSOPSW }} | |
wdtRuntimePassword: ${{ secrets.WDT_RUNTIMEPSW}} | |
wlsUserName: ${{ secrets.WLS_USERNAME }} | |
wlsPassword: ${{ secrets.WLS_PSW }} | |
resourceGroupForDB: wlsd-db-${{ github.repository_owner }}-${{ 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 }} | |
wlsImageTag: "14.1.2.0-generic-jdk17-ol9" | |
jobs: | |
preflight: | |
outputs: | |
artifactName: ${{steps.artifact_file.outputs.artifactName}} | |
isForDemo: ${{ steps.setup-env-variables-based-on-dispatch-event.outputs.isForDemo }} | |
azCliVersion: ${{steps.set-az-cli-version.outputs.azCliVersion}} | |
vmSize: ${{ steps.setup-env-variables-based-on-dispatch-event.outputs.vmSize }} | |
location: ${{ steps.setup-env-variables-based-on-dispatch-event.outputs.location }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/[email protected] | |
- name: Set AZ CLI Version and save in variable azCliVersion | |
uses: ./.github/actions/setvars | |
with: | |
varFilePath: ./.github/variables/vm-dependencies.env | |
- name: Output Az CLi version | |
id: set-az-cli-version | |
run: | | |
echo "azCliVersion=${azCliVersion}" >> $GITHUB_OUTPUT | |
- name: Get versions of external dependencies | |
id: get-external-dependencies-version | |
run: | | |
curl -Lo external-deps-versions.properties https://raw.githubusercontent.com/Azure/azure-javaee-iaas/main/external-deps-versions.properties | |
source external-deps-versions.properties | |
echo "bicepVersion=${BICEP_VERSION}" >> $GITHUB_ENV | |
echo "refArmttk=${ARM_TTK_REFERENCE}" >> $GITHUB_ENV | |
- name: Setup environment variables | |
id: setup-env-variables-based-on-dispatch-event | |
run: | | |
location=centralus # default value | |
if [ ${{ github.event_name }} == 'workflow_dispatch' ]; then | |
isForDemo=${{ github.event.inputs.isForDemo }} | |
vmSize=${{ github.event.inputs.vmSize }} | |
location=${{ github.event.inputs.location }} | |
else | |
isForDemo=${{ github.event.client_payload.isForDemo }} | |
vmSize=${{ github.event.client_payload.vmSize }} | |
location=${{ github.event.client_payload.location }} | |
fi | |
echo "##[set-output name=isForDemo;]${isForDemo}" | |
echo "##[set-output name=vmSize;]${vmSize}" | |
echo "##[set-output name=location;]${location}" | |
echo "isForDemo=${isForDemo}" >> $GITHUB_ENV | |
echo "vmSize=${vmSize}" >> $GITHUB_ENV | |
echo "location=${location}" >> $GITHUB_ENV | |
- uses: actions/[email protected] | |
- name: Set up Maven with GitHub token | |
uses: ./.github/actions/setupmaven | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set up bicep | |
run: | | |
curl -Lo bicep https://github.com/Azure/bicep/releases/download/${bicepVersion}/bicep-linux-x64 | |
chmod +x ./bicep | |
sudo mv ./bicep /usr/local/bin/bicep | |
bicep --version | |
- name: Checkout arm-ttk | |
uses: actions/checkout@v2 | |
with: | |
repository: Azure/arm-ttk | |
path: arm-ttk | |
ref: ${{ env.refArmttk }} | |
- name: Checkout weblogic-azure | |
uses: actions/checkout@v2 | |
with: | |
path: weblogic-azure | |
- name: Build and test weblogic-azure/weblogic-azure-aks | |
run: mvn -Pbicep -Passembly clean install -Ptemplate-validation-tests --file weblogic-azure/weblogic-azure-aks/pom.xml | |
- name: Generate artifact file name and path | |
id: artifact_file | |
run: | | |
version=$(mvn -q -Dexec.executable=echo -Dexec.args='${version.wls-on-aks-azure-marketplace}' --file weblogic-azure/pom.xml --non-recursive exec:exec) | |
artifactName=wls-on-aks-azure-marketplace-$version-arm-assembly | |
unzip weblogic-azure/weblogic-azure-aks/target/$artifactName.zip -d weblogic-azure/weblogic-azure-aks/target/$artifactName | |
echo "##[set-output name=artifactName;]${artifactName}" | |
echo "##[set-output name=artifactPath;]weblogic-azure/weblogic-azure-aks/target/$artifactName" | |
- name: Archive weblogic-azure/weblogic-azure-aks template | |
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 | |
if: success() | |
with: | |
name: ${{steps.artifact_file.outputs.artifactName}} | |
path: ${{steps.artifact_file.outputs.artifactPath}} | |
deploy-storage-account: | |
needs: preflight | |
runs-on: ubuntu-latest | |
steps: | |
- name: Get AZ CLI Version | |
run: | | |
echo "azCliVersion=${{needs.preflight.outputs.azCliVersion}}" >> $GITHUB_ENV | |
echo "location=${{needs.preflight.outputs.location}}" >> $GITHUB_ENV | |
- name: Checkout Azure-Samples/cargotracker-wls-aks | |
uses: actions/checkout@v2 | |
with: | |
repository: Azure-Samples/cargotracker-wls-aks | |
path: cargotracker | |
- uses: actions/setup-java@v4 | |
with: | |
distribution: 'microsoft' | |
java-version: '11' | |
- run: mvn clean install -PweblogicOnAks --file cargotracker/pom.xml | |
- name: Query version string for deployment verification | |
run: | | |
PROPERTY_FILE="cargotracker/target/cargo-tracker/WEB-INF/classes/org/eclipse/cargotracker/messages.properties" | |
PROP_KEY=versionString | |
deployVersion=$(cat $PROPERTY_FILE | grep "$PROP_KEY" | cut -d '=' -f 2) | |
echo "deployVersion=${deployVersion}" >> $GITHUB_ENV | |
- 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 $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 $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 }} --account-name ${{ env.storageAccountName }} | |
- name: Upload built web app war file | |
uses: azure/CLI@v1 | |
with: | |
azcliversion: ${{ env.azCliVersion }} | |
inlineScript: | | |
az storage blob upload --account-name ${{ env.storageAccountName }} --container-name ${{ env.storageContainerName }} --file cargotracker/target/cargo-tracker.war --name cargo-tracker.war | |
deploy-wls-on-aks: | |
needs: [deploy-storage-account, preflight] | |
runs-on: ubuntu-latest | |
env: ${{ fromJson(inputs.configurations_for_it) }} | |
steps: | |
- name: Get AZ CLI Version | |
run: | | |
echo "azCliVersion=${{needs.preflight.outputs.azCliVersion}}" >> $GITHUB_ENV | |
echo "location=${{needs.preflight.outputs.location}}" >> $GITHUB_ENV | |
- name: Checkout weblogic-azure | |
uses: actions/checkout@v4 | |
with: | |
path: weblogic-azure | |
- name: Download artifact for deployment | |
uses: actions/download-artifact@95815c38cf2ff2164869cbab79da8d1f422bc89e # v4.2.1 | |
with: | |
name: ${{needs.preflight.outputs.artifactName}} | |
path: ${{needs.preflight.outputs.artifactName}} | |
- uses: azure/login@v1 | |
id: azure-login | |
with: | |
creds: ${{ env.azureCredentials }} | |
- name: Query web app blob url and set to env | |
uses: azure/CLI@v1 | |
with: | |
azcliversion: ${{ env.azCliVersion }} | |
inlineScript: | | |
sasTokenValidTime=3600 | |
expiryData=$(( `date +%s`+${sasTokenValidTime})) | |
sasEnd=`date -d@"$expiryData" -u '+%Y-%m-%dT%H:%MZ'` | |
sasToken=$(az storage account generate-sas \ | |
--permissions r \ | |
--account-name ${{ env.storageAccountName }} \ | |
--services b \ | |
--resource-types sco \ | |
--expiry $sasEnd -o tsv) | |
cargoTrackerBlobUrl=$(az storage blob url \ | |
--container-name ${{ env.storageContainerName }} \ | |
--name cargo-tracker.war \ | |
--account-name ${{ env.storageAccountName }} \ | |
--sas-token ${sasToken} -o tsv) | |
echo "cargoTrackerBlobUrl=${cargoTrackerBlobUrl}" >> $GITHUB_ENV | |
- name: Create Resource Group | |
uses: azure/CLI@v1 | |
with: | |
azcliversion: ${{ env.azCliVersion }} | |
inlineScript: | | |
echo "create resource group" ${{ env.resourceGroupForWlsAks }} | |
az group create --verbose --name ${{ env.resourceGroupForWlsAks }} --location $location | |
- name: Checkout Azure-Samples/cargotracker-wls-aks | |
uses: actions/checkout@v2 | |
with: | |
repository: Azure-Samples/cargotracker-wls-aks | |
path: cargotracker | |
- name: Provision Azure Vnet | |
id: vnet-provision | |
if: ${{ env.newOrExistingVnetForApplicationGateway == 'existing' }} | |
run: | | |
echo "Provisioning Azure Vnet with subnet" | |
az network vnet create \ | |
--resource-group ${{ env.resourceGroupForWlsAks }} \ | |
--name ${{ env.vnetForApplicationGateway.name }} \ | |
--address-prefix 10.0.0.0/28 \ | |
--subnet-name ${{ env.vnetForApplicationGateway.subnets.gatewaySubnet.name }} \ | |
--subnet-prefix 10.0.0.0/29 | |
- name: Create Database Resource Group | |
uses: azure/CLI@v1 | |
with: | |
azcliversion: ${{ env.azCliVersion }} | |
inlineScript: | | |
echo "create database resource group" ${{ env.resourceGroupForDB }} | |
az group create --verbose --name ${{ env.resourceGroupForDB }} --location $location | |
- name: Provision database | |
id: database-provision | |
uses: ./weblogic-azure/.github/actions/database-provision | |
with: | |
databaseType: ${{ inputs.databaseType }} | |
resourceGroup: ${{ env.resourceGroupForDB }} | |
uamiName: ${{ env.uamiName }} | |
location: $location | |
dbInstanceName: ${{ env.dbServerName }} | |
dbPassword: ${{ env.dbPassword }} | |
databaseName: ${{ env.dbName }} | |
dbAdminUser: ${{ env.dbAdminUser }} | |
- name: Get database parameters | |
id: database-parameters | |
uses: ./weblogic-azure/.github/actions/database-parameters | |
with: | |
databaseType: ${{ inputs.databaseType }} | |
uamiId: ${{ steps.database-provision.outputs.uamiId }} | |
serverHost: ${{ steps.database-provision.outputs.serverHost }} | |
dbInstanceName: ${{ env.dbServerName }} | |
databaseName: ${{ env.dbName }} | |
dbAdminUser: ${{ env.dbAdminUser }} | |
- name: Prepare parameter file | |
run: | | |
if ${{ env.createAKSCluster == 'false' }}; then | |
echo "Deploy with an existing AKS cluster" | |
export createAKSCluster=false | |
# the env aksClusterName is set in the `validation-plan-aks.json` file. | |
export aksClusterName=${{ env.aksClusterName }} | |
export aksClusterRGName=${{ env.resourceGroupForWlsAks }} | |
else | |
echo "Deploy with a new AKS cluster" | |
export createAKSCluster=true | |
export aksClusterName="aks-cluster-${{ github.run_id }}-${{ github.run_number }}" | |
export aksClusterRGName=${{ env.resourceGroupForWlsAks }} | |
fi | |
if ${{ env.enableAppGWIngress == 'false' }}; then | |
echo "Application Gateway Ingress Controller is disabled" | |
export enableAppGWIngress=false | |
else | |
echo "Application Gateway Ingress Controller is enabled" | |
export enableAppGWIngress=true | |
fi | |
# prepare parameters for vnet and application gateway | |
export newOrExistingVnetForApplicationGateway=${{ env.newOrExistingVnetForApplicationGateway }} | |
export vnetForApplicationGateway=${{ env.vnetForApplicationGateway.name }} | |
export vnetRGNameForApplicationGateway=${{ env.resourceGroupForWlsAks }} | |
echo "generate parameter file" | |
export databaseType='${{ steps.database-parameters.outputs.databaseType }}' | |
export enableDB=${{ steps.database-parameters.outputs.enableDB }} | |
export enablePswlessConnection=${{ steps.database-parameters.outputs.enablePswlessConnection }} | |
export dsConnectionURL='${{ steps.database-parameters.outputs.dsConnectionURL }}' | |
export dbUser='${{ steps.database-parameters.outputs.dbUser }}' | |
export dbIdentity='${{ steps.database-parameters.outputs.dbIdentity }}' | |
export dbPassword=${{ env.dbPassword }} | |
export wlsImageTag=${{ env.wlsImageTag }} | |
export gitUserName=${{ github.repository_owner }} | |
export testbranchName=${{ github.sha }} | |
export appPackageUrls=${cargoTrackerBlobUrl} | |
export location=${location} | |
export ocrSSOPSW=${ocrSSOPSW} | |
export ocrSSOUser=${ocrSSOUser} | |
export wdtRuntimePassword=${wdtRuntimePassword} | |
export wlsPassword=${wlsPassword} | |
export wlsUserName=${wlsUserName} | |
export vmSize=${{ needs.preflight.outputs.vmSize }} | |
echo "Generating parameter file..." | |
envsubst < "./weblogic-azure/weblogic-azure-aks/src/test/parameters-deploy-template.json" > "./weblogic-azure/weblogic-azure-aks/src/test/parameters-deploy-${{ github.job }}.json" | |
- name: Archive parameters-deploy.json | |
uses: actions/[email protected] | |
if: success() | |
with: | |
name: parameters-deploy.json | |
path: ./weblogic-azure/weblogic-azure-aks/src/test/parameters-deploy-${{ github.job }}.json | |
- name: Provision AKS Cluster as an existing cluster for deployment | |
if: ${{ env.createAKSCluster == 'false' }} | |
run: | | |
# the value of **createAKSCluster** is `false`, which means the offer won't create a new AKS cluster, but use an existing one. | |
# in order to simulate the same behavior as the offer, we need to create a new AKS cluster. | |
az feature register \ | |
--namespace "Microsoft.ContainerService" \ | |
--name "AppGatewayWithOverlayPreview" | |
az provider register --namespace Microsoft.ContainerService | |
az aks create \ | |
-n ${{ env.aksClusterName }} \ | |
-g ${{ env.resourceGroupForWlsAks }} \ | |
--enable-managed-identity \ | |
--network-plugin azure \ | |
--load-balancer-sku standard \ | |
--generate-ssh-keys | |
- name: Deploy WebLogic Server Cluster Domain offer | |
id: deploy-wls-cluster | |
uses: azure/CLI@v1 | |
with: | |
azcliversion: ${{ env.azCliVersion }} | |
inlineScript: | | |
artifactName=${{ needs.preflight.outputs.artifactName }} | |
az deployment group create \ | |
--verbose \ | |
--resource-group ${{ env.resourceGroupForWlsAks }} \ | |
--name wls-on-aks \ | |
--parameters @weblogic-azure/weblogic-azure-aks/src/test/parameters-deploy-${{ github.job }}.json \ | |
--template-file ${artifactName}/mainTemplate.json | |
- name: Query Application Gateway URL | |
run: | | |
if ${{ env.enableAppGWIngress == 'false' }}; then | |
echo skipping current step as Application Gateway Ingress Controller is disabled | |
exit 0 | |
fi | |
appgatewayname=$(az resource list --resource-group ${{ env.resourceGroupForWlsAks }} --query "[?type=='Microsoft.Network/applicationGateways'].name|[0]" -o tsv) | |
echo $appgatewayname | |
publicIpAddressId=$(az network application-gateway show --resource-group ${{ env.resourceGroupForWlsAks }} --name ${appgatewayname} --query frontendIPConfigurations[0].publicIPAddress.id -o tsv) | |
echo $publicIpAddressId | |
appGatewayURL=$(az network public-ip show --resource-group ${{ env.resourceGroupForWlsAks }} --ids ${publicIpAddressId} --query dnsSettings.fqdn -o tsv) | |
echo $appGatewayURL | |
echo "appGatewayURL=${appGatewayURL}" >> $GITHUB_ENV | |
- name: Verify Cargo Tracker is deployed as expected | |
run: | | |
if ${{ env.enableAppGWIngress == 'false' }}; then | |
echo skipping current step as Application Gateway Ingress Controller is disabled | |
exit 0 | |
fi | |
echo "Verifying Cargo Tracker is deployed as expected" | |
curl --verbose http://${{ env.appGatewayURL }}/cargo-tracker/ | |
response=$(curl --write-out '%{http_code}' --silent --output /dev/null http://${{ env.appGatewayURL }}/cargo-tracker/) | |
echo "$response" | |
if [ "$response" -ne 200 ]; then | |
echo "Cargo Tracker is not accessible" | |
exit 1 | |
else | |
echo "Cargo Tracker is accessible" | |
fi | |
- name: Install kubectl | |
run: | | |
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" | |
curl -LO "https://dl.k8s.io/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl.sha256" | |
sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl | |
kubectl version --client | |
- name: Connect to AKS cluster | |
run: | | |
echo "connect to cluster" | |
aksClusterName=$(az resource list --resource-group ${{ env.resourceGroupForWlsAks }} --query "[?type=='Microsoft.ContainerService/managedClusters'].name|[0]" -o tsv) | |
az aks get-credentials --resource-group ${{ env.resourceGroupForWlsAks }} --name $aksClusterName | |
- name: Generate&Apply configmap | |
run: | | |
wlsDomainNS=sample-domain1-ns | |
wlsConfigmapName=sample-domain1-wdt-config-map | |
wlsConfigmapJson=cargo-tracker-db.json | |
modelFilePath=models | |
mkdir ${modelFilePath} | |
echo "create configmap" | |
echo "export exisiting configmap" | |
kubectl -n ${wlsDomainNS} get configmap ${wlsConfigmapName} -o json >${wlsConfigmapJson} | |
echo "query model keys" | |
keyList=$(cat ${wlsConfigmapJson} | jq '.data | keys[]' | tr -d "\"") | |
for item in $keyList; do | |
data=$(cat ${wlsConfigmapJson} | jq ".data[\"${item}\"]") | |
data=$(echo "${data:1:${#data}-2}") | |
echo -e "${data}" >${modelFilePath}/${item} | |
done | |
# remove current configmap and create a new one | |
kubectl -n ${wlsDomainNS} delete configmap ${wlsConfigmapName} | |
cp cargotracker/src/test/aks/cargo-tracker-jms.yaml ${modelFilePath}/cargo-tracker-jms.yaml | |
kubectl -n ${wlsDomainNS} create configmap ${wlsConfigmapName} \ | |
--from-file=${modelFilePath} | |
kubectl -n ${wlsDomainNS} label configmap ${wlsConfigmapName} \ | |
weblogic.domainUID=sample-domain1 | |
restartVersion=$(kubectl -n ${wlsDomainNS} get domain sample-domain1 '-o=jsonpath={.spec.restartVersion}') | |
# increase restart version | |
restartVersion=$((restartVersion + 1)) | |
# record timestamp before apply changes | |
timestampBeforePatchingDomain=$(date +%s) | |
# get the replica number | |
clusterName=$(kubectl get cluster -n ${wlsDomainNS} -o json | jq -r '.items[0].metadata.name') | |
replicas=$(kubectl -n ${wlsDomainNS} get cluster ${clusterName} -o json | jq '. | .spec.replicas') | |
echo "append configmap and update restart version" | |
kubectl -n ${wlsDomainNS} patch domain sample-domain1 \ | |
--type=json \ | |
'-p=[{"op": "replace", "path": "/spec/restartVersion", "value": "'${restartVersion}'" }, {"op": "add", "path": "/spec/configuration/model/configMap", "value": "'${wlsConfigmapName}'" }]' | |
echo "timestampBeforePatchingDomain=${timestampBeforePatchingDomain}" >> $GITHUB_ENV | |
echo "replicas=${replicas}" >> $GITHUB_ENV | |
- name: Verify pods are restarted | |
run: | | |
# interval of checking pod status. | |
checkPodStatusInterval=20 | |
# max attempt to check pod status. | |
checkPodStatusMaxAttemps=30 | |
# domain and namespaces | |
wlsDomainUID="sample-domain1" | |
wlsDomainNS=${wlsDomainUID}-ns | |
updatedPodNum=0 | |
attempt=0 | |
echo $timestampBeforePatchingDomain $appReplicas $wlsDomainUID $checkPodStatusMaxAttemps $checkPodStatusInterval | |
while [[ ${updatedPodNum} -le ${appReplicas} ]] && [[ $attempt -le ${checkPodStatusMaxAttemps} ]]; do | |
echo "attempts ${attempt}" | |
ret=$(kubectl get pods -n ${wlsDomainNS} -l weblogic.domainUID=${wlsDomainUID} -o json | jq '.items[] | .metadata.creationTimestamp' | tr -d "\"") | |
counter=0 | |
for item in $ret; do | |
podCreateTimeStamp=$(date -u -d "${item}" +"%s") | |
echo "pod create time: $podCreateTimeStamp, base time: ${timestampBeforePatchingDomain}" | |
if [[ ${podCreateTimeStamp} -gt ${timestampBeforePatchingDomain} ]]; then | |
counter=$((counter + 1)) | |
fi | |
done | |
updatedPodNum=$counter | |
echo "Number of new pod: ${updatedPodNum}" | |
attempt=$((attempt + 1)) | |
sleep ${checkPodStatusInterval} | |
done | |
if [[ ${attempt} -gt ${checkPodStatusMaxAttemps} ]]; then | |
echo "Failed to restart all weblogic server pods. " | |
exit 1 | |
fi | |
cleanup: | |
needs: [deploy-wls-on-aks, preflight] | |
if: ${{ always() && needs.preflight.outputs.isForDemo == 'false' }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Get AZ CLI Version | |
run: | | |
echo "azCliVersion=${{needs.preflight.outputs.azCliVersion}}" >> $GITHUB_ENV | |
- uses: azure/login@v1 | |
id: azure-login | |
with: | |
creds: ${{ secrets.AZURE_CREDENTIALS }} | |
- name: Delete Storage Account Resource Group | |
id: delete-sa-resource-group | |
uses: azure/CLI@v1 | |
with: | |
azcliversion: ${{ env.azCliVersion }} | |
inlineScript: | | |
echo "delete... " ${{ env.resourceGroupForStorageAccount }} | |
az group delete --yes --no-wait --verbose --name ${{ env.resourceGroupForStorageAccount }} | |
- name: Delete DB Resource Group | |
id: delete-db-resource-group | |
uses: azure/CLI@v1 | |
with: | |
azcliversion: ${{ env.azCliVersion }} | |
inlineScript: | | |
echo "delete... " ${{ env.resourceGroupForDB }} | |
az group delete --yes --no-wait --verbose --name ${{ env.resourceGroupForDB }} | |
- name: Delete AKS Resource Group | |
id: delete-aks-resource-group | |
uses: azure/CLI@v1 | |
with: | |
azcliversion: ${{ env.azCliVersion }} | |
inlineScript: | | |
echo "delete... " ${{ env.resourceGroupForWlsAks }} | |
az group delete --yes --no-wait --verbose --name ${{ env.resourceGroupForWlsAks }} |