Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .github/workflows/testWlsAksWithDependencyCreation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ on:
description: 'Replaced into https://raw.githubusercontent.com/#gitUserName#/weblogic-azure/#testbranchName#/weblogic-azure-aks/src/main/arm/'
required: true
default: main
vmSize:
description: 'The VM size for the AKS pool'
required: true
default: Standard_D2s_v3
# 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": {"gitUserNameForArtifactsLocation": "<github_user>", "testBranchNameForArtifactsLocation": "<branch_name>", "isForDemo": "false"}}'
repository_dispatch:
Expand Down Expand Up @@ -46,6 +50,7 @@ jobs:
gitUserNameForArtifactsLocation: ${{ steps.setup-env-variables-based-on-dispatch-event.outputs.gitUserNameForArtifactsLocation }}
testBranchNameForArtifactsLocation: ${{ steps.setup-env-variables-based-on-dispatch-event.outputs.testBranchNameForArtifactsLocation }}
azCliVersion: ${{steps.set-az-cli-version.outputs.azCliVersion}}
vmSize: ${{ steps.setup-env-variables-based-on-dispatch-event.outputs.vmSize }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2.3.4
Expand All @@ -71,19 +76,23 @@ jobs:
isForDemo=${{ github.event.inputs.isForDemo }}
gitUserNameForArtifactsLocation=${{ github.event.inputs.gitUserNameForArtifactsLocation }}
testBranchNameForArtifactsLocation=${{ github.event.inputs.testBranchNameForArtifactsLocation }}
vmSize=${{ github.event.inputs.vmSize }}
else
isForDemo=${{ github.event.client_payload.isForDemo }}
gitUserNameForArtifactsLocation=${{ github.event.client_payload.gitUserNameForArtifactsLocation }}
testBranchNameForArtifactsLocation=${{ github.event.client_payload.testBranchNameForArtifactsLocation }}
vmSize=${{ github.event.client_payload.vmSize }}
fi

echo "##[set-output name=isForDemo;]${isForDemo}"
echo "##[set-output name=gitUserNameForArtifactsLocation;]${gitUserNameForArtifactsLocation}"
echo "##[set-output name=testBranchNameForArtifactsLocation;]${testBranchNameForArtifactsLocation}"
echo "##[set-output name=vmSize;]${vmSize}"

echo "isForDemo=${isForDemo}" >> $GITHUB_ENV
echo "gitUserNameForArtifactsLocation=${gitUserNameForArtifactsLocation}" >> $GITHUB_ENV
echo "testBranchNameForArtifactsLocation=${testBranchNameForArtifactsLocation}" >> $GITHUB_ENV
echo "vmSize=${vmSize}" >> $GITHUB_ENV
- uses: actions/checkout@v2.3.4
- name: Set up Maven with GitHub token
uses: ./.github/actions/setupmaven
Expand Down Expand Up @@ -273,6 +282,7 @@ jobs:
${wdtRuntimePassword} \
${wlsPassword} \
${wlsUserName} \
${{ needs.preflight.outputs.vmSize }} \
weblogic-azure/weblogic-azure-aks/src/test/setupWlsAksParameters.jsonc
- name: Deploy WebLogic Server Cluster Domain offer
id: deploy-wls-cluster
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/testWlsAksWithoutDependencyCreation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ jobs:
gitUserNameForArtifactsLocation: ${{ steps.setup-env-variables-based-on-dispatch-event.outputs.gitUserNameForArtifactsLocation }}
testBranchNameForArtifactsLocation: ${{ steps.setup-env-variables-based-on-dispatch-event.outputs.testBranchNameForArtifactsLocation }}
azCliVersion: ${{steps.set-az-cli-version.outputs.azCliVersion}}
vmSize: ${{ steps.setup-env-variables-based-on-dispatch-event.outputs.vmSize }}
steps:
- uses: actions/checkout@v2.3.4
- name: Set AZ CLI Version
Expand Down Expand Up @@ -87,6 +88,7 @@ jobs:
isForDemo=${{ github.event.inputs.isForDemo }}
gitUserNameForArtifactsLocation=${{ github.event.inputs.gitUserNameForArtifactsLocation }}
testBranchNameForArtifactsLocation=${{ github.event.inputs.testBranchNameForArtifactsLocation }}
vmSize=${{ github.event.inputs.vmSize }}
else
resourceGroupForWlsAks=wlsd-aks-${{ github.event.client_payload.disambiguationSuffix }}-${{ github.run_number }}
dbName=${{ github.event.client_payload.dbName }}
Expand All @@ -95,6 +97,7 @@ jobs:
isForDemo=${{ github.event.client_payload.isForDemo }}
gitUserNameForArtifactsLocation=${{ github.event.client_payload.gitUserNameForArtifactsLocation }}
testBranchNameForArtifactsLocation=${{ github.event.client_payload.testBranchNameForArtifactsLocation }}
vmSize=${{ github.event.client_payload.vmSize }}
fi

echo "##[set-output name=resourceGroupForWlsAks;]${resourceGroupForWlsAks}"
Expand All @@ -104,6 +107,7 @@ jobs:
echo "##[set-output name=isForDemo;]${isForDemo}"
echo "##[set-output name=gitUserNameForArtifactsLocation;]${gitUserNameForArtifactsLocation}"
echo "##[set-output name=testBranchNameForArtifactsLocation;]${testBranchNameForArtifactsLocation}"
echo "##[set-output name=vmSize;]${vmSize}"

echo "resourceGroupForWlsAks=${resourceGroupForWlsAks}" >> $GITHUB_ENV
echo "dbName=${dbName}" >> $GITHUB_ENV
Expand All @@ -112,6 +116,7 @@ jobs:
echo "isForDemo=${isForDemo}" >> $GITHUB_ENV
echo "gitUserNameForArtifactsLocation=${gitUserNameForArtifactsLocation}" >> $GITHUB_ENV
echo "testBranchNameForArtifactsLocation=${testBranchNameForArtifactsLocation}" >> $GITHUB_ENV
echo "vmSize=${vmSize}" >> $GITHUB_ENV
- uses: actions/checkout@v2.3.4
- name: Set up Maven with GitHub token
uses: ./.github/actions/setupmaven
Expand Down Expand Up @@ -240,6 +245,7 @@ jobs:
${wdtRuntimePassword} \
${wlsPassword} \
${wlsUserName} \
${{ needs.preflight.outputs.vmSize }} \
weblogic-azure/weblogic-azure-aks/src/test/setupWlsAksParameters.jsonc
- name: Deploy WebLogic Server Cluster Domain offer
id: deploy-wls-cluster
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
<properties>
<!-- versions start -->
<!-- weblogic azure aks versions -->
<version.wls-on-aks-azure-marketplace>1.0.79</version.wls-on-aks-azure-marketplace>
<version.wls-on-aks-azure-marketplace>1.0.80</version.wls-on-aks-azure-marketplace>
<!-- weblogic azure vm versions -->
<version.arm-oraclelinux-wls>1.0.27</version.arm-oraclelinux-wls>
<version.arm-oraclelinux-wls-admin>1.0.51</version.arm-oraclelinux-wls-admin>
Expand Down
11 changes: 10 additions & 1 deletion weblogic-azure-aks/src/main/arm/createUiDefinition.json
Original file line number Diff line number Diff line change
Expand Up @@ -601,6 +601,15 @@
}
]
}
},
{
"name": "unsupportedPlatformInfo1",
"type": "Microsoft.Common.InfoBox",
"visible": "[and(contains(steps('section_aks').clusterInfo.nodeVMSizeSelector,'p'), not(contains(parse('[\"14.1.1.0-11\", \"14.1.1.0-8\", \"14.1.1.0-slim-11\", \"14.1.1.0-slim-8\", \"12.2.1.4\", \"12.2.1.4-slim\"]'),if(equals(steps('section_aks').imageInfo.oracleImageSelector, 'others'), steps('section_aks').imageInfo.fromOracleImage, steps('section_aks').imageInfo.oracleImageSelector))))]",
"options": {
"icon": "Error",
"text": "The selected image is not compatible with the ARM64 platform. Please choose a different image or select a different size from <b>AKS</b> -> <b>Azure Kubernetes Service</b> -> <b>Node size</b>. For more information, see <a href=https://learn.microsoft.com/azure/virtual-machines/vm-naming-conventions>the Azure documentation</a>."
}
}
],
"visible": true
Expand Down Expand Up @@ -2418,4 +2427,4 @@
"wlsUserName": "[basics('basicsRequired').wlsUserName]"
}
}
}
}
65 changes: 53 additions & 12 deletions weblogic-azure-aks/src/main/arm/scripts/buildWLSDockerImage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -187,39 +187,78 @@ function download_mysql_driver() {
fi
}

# Install docker, zip, unzip and java
# Download WebLogic Tools
function install_utilities() {
# Install docker
function install_docker_multi_arch(){
# Install docker https://docs.docker.com/engine/install/ubuntu/#install-using-the-repository
# Add Docker's official GPG key:
sudo apt-get -q update
sudo apt-get -y -q install apt-transport-https
curl -m ${curlMaxTime} --retry ${retryMaxAttempt} -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
sudo apt-get -y -q install ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -m ${curlMaxTime} --retry ${retryMaxAttempt} -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc

# Add the repository to Apt sources:
echo \
"deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list >/dev/null
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get -q update
sudo apt-get -y -q install docker-ce docker-ce-cli containerd.io

echo "docker version"
sudo docker --version
validate_status "Check status of docker."
sudo systemctl start docker
}

function install_openjdk11_x64(){
# Install Microsoft OpenJDK
wget https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
# Valid values are only '18.04', '20.04', and '22.04'
ubuntu_release=`lsb_release -rs`
wget https://packages.microsoft.com/config/ubuntu/${ubuntu_release}/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb
sudo apt -q update
sudo apt -y -q install msopenjdk-11

sudo apt-get -y -q install apt-transport-https
sudo apt-get -q update
sudo apt-get -y -q install msopenjdk-11

echo "java version"
java -version
validate_status "Check status of Zulu JDK 8."
validate_status "Check status of OpenJDK 11."


export JAVA_HOME=/usr/lib/jvm/msopenjdk-11-$(dpkg --print-architecture)
if [ ! -d "${JAVA_HOME}" ]; then
echo "Java home ${JAVA_HOME} does not exist."
exit 1
fi
}

function install_openjdk11_arm64(){
local zipFileName="microsoft-jdk-11.tar.gz"
sudo curl -m ${curlMaxTime} --retry ${retryMaxAttempt} -fsSL ${jdkArm64Url} -o ${zipFileName}
sudo mkdir -p /usr/lib/jvm
local dirName=$(sudo tar -xzvf ${zipFileName} | head -1 | cut -f1 -d"/")
sudo tar -xzvf ${zipFileName}
sudo mv ${dirName} msopenjdk-11-amd64
sudo mv -f msopenjdk-11-amd64 /usr/lib/jvm/

export JAVA_HOME=/usr/lib/jvm/msopenjdk-11-amd64
if [ ! -d "${JAVA_HOME}" ]; then
echo "Java home ${JAVA_HOME} does not exist"
exit 1
fi
}

# Install docker, zip, unzip and java
# Download WebLogic Tools
function install_utilities() {
install_docker_multi_arch

if [[ "$(dpkg --print-architecture)" == "arm64" ]]; then
install_openjdk11_arm64
else
install_openjdk11_x64
fi

sudo apt -y -q install zip
zip --help
Expand Down Expand Up @@ -378,6 +417,7 @@ function build_wls_image() {
--wdtArchive ${scriptDir}/model-images/archive.zip \
--wdtModelOnly \
--wdtDomainType WLS \
--platform ${cpuPlatform} \
--chown ${user}:${group}

validate_status "Check status of building WLS domain image."
Expand Down Expand Up @@ -413,6 +453,7 @@ export useOracleImage=${11}
export dbDriversUrls=${12}
export enablePswlessConnection=${13}
export dbType=${14}
export cpuPlatform=${15}

export acrImagePath="$azureACRServer/aks-wls-images:${imageTag}"

Expand Down
4 changes: 4 additions & 0 deletions weblogic-azure-aks/src/main/arm/scripts/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ export constAdminT3AddressEnvName="T3_TUNNELING_ADMIN_ADDRESS"
export constAdminServerName='admin-server'
export constClusterName='cluster-1'
export constClusterT3AddressEnvName="T3_TUNNELING_CLUSTER_ADDRESS"
export constARM64Platform="arm64"
export constX86Platform="amd64"
export constMultiArchPlatform="Multi-architecture"
export constDBTypeMySQL="mysql"
export constDBTypeSqlServer="sqlserver"
export constDefaultJavaOptions="-Dlog4j2.formatMsgNoLookups=true -Dweblogic.StdoutDebugEnabled=false" # the java options will be applied to the cluster
Expand Down Expand Up @@ -63,3 +66,4 @@ export retryInterval=10
export wlsContainerName="weblogic-server"
export wlsPostgresqlDriverUrl="https://jdbc.postgresql.org/download/postgresql-42.5.1.jar"
export wlsMSSQLDriverUrl="https://repo.maven.apache.org/maven2/com/microsoft/sqlserver/mssql-jdbc/10.2.1.jre8/mssql-jdbc-10.2.1.jre8.jar"
export jdkArm64Url="https://aka.ms/download-jdk/microsoft-jdk-11.0.23-linux-aarch64.tar.gz"
24 changes: 22 additions & 2 deletions weblogic-azure-aks/src/main/arm/scripts/createVMAndBuildImage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -96,20 +96,40 @@ function build_docker_image() {
# Create vm to build docker image
vmName="VM-UBUNTU-WLS-AKS-$(date +%s)"

# az vm image list --publisher Canonical --offer UbuntuServer --all -o table
ubuntuImage="Canonical:UbuntuServer:18.04-LTS:latest"

if [[ "${CPU_PLATFORM}" == "${constARM64Platform}" ]]; then
ubuntuImage="Canonical:UbuntuServer:18_04-lts-arm64:latest"
fi

# query AKS vm size
# use the same VM size to create the Ubuntu machine, make sure the architecture is matched.
local vmSize=$(az aks show --name ${AKS_CLUSTER_NAME} --resource-group ${AKS_CLUSTER_RESOURCEGROUP_NAME} \
| jq '.agentPoolProfiles[] | select(.name=="agentpool") | .vmSize' \
| tr -d "\"")

# if vmSize is empty or null, exit
if [[ "${vmSize}" == "" || "${vmSize}" == "null" ]]; then
echo_stderr "Failed to obtain VM size of AKS ${AKS_CLUSTER_NAME} in ${AKS_CLUSTER_RESOURCEGROUP_NAME}."
exit 1
fi

# MICROSOFT_INTERNAL
# Specify tag 'SkipASMAzSecPack' to skip policy 'linuxazuresecuritypackautodeployiaas_1.6'
# Specify tag 'SkipNRMS*' to skip Microsoft internal NRMS policy, which causes vm-redeployed issue
az vm create \
--resource-group ${CURRENT_RESOURCEGROUP_NAME} \
--name ${vmName} \
--image "Canonical:UbuntuServer:18.04-LTS:latest" \
--image "${ubuntuImage}" \
--admin-username azureuser \
--generate-ssh-keys \
--nsg-rule NONE \
--enable-agent true \
--vnet-name ${vmName}VNET \
--enable-auto-update false \
--public-ip-address "" \
--size ${vmSize} \
--tags SkipASMAzSecPack=true SkipNRMSCorp=true SkipNRMSDatabricks=true SkipNRMSDB=true SkipNRMSHigh=true SkipNRMSMedium=true SkipNRMSRDPSSH=true SkipNRMSSAW=true SkipNRMSMgmt=true --verbose

if [[ "${USE_ORACLE_IMAGE,,}" == "${constTrue}" ]]; then
Expand All @@ -128,7 +148,7 @@ function build_docker_image() {
--publisher Microsoft.Azure.Extensions \
--version 2.0 \
--settings "{ \"fileUris\": [\"${SCRIPT_LOCATION}model.properties\",\"${SCRIPT_LOCATION}genImageModel.sh\",\"${SCRIPT_LOCATION}buildWLSDockerImage.sh\",\"${SCRIPT_LOCATION}common.sh\"]}" \
--protected-settings "{\"commandToExecute\":\"echo ${acrPassword} ${ORACLE_ACCOUNT_PASSWORD} | bash buildWLSDockerImage.sh ${wlsImagePath} ${acrLoginServer} ${acrUser} ${newImageTag} ${WLS_APP_PACKAGE_URLS} ${ORACLE_ACCOUNT_NAME} ${WLS_CLUSTER_SIZE} ${ENABLE_CUSTOM_SSL} ${ENABLE_ADMIN_CUSTOM_T3} ${ENABLE_CLUSTER_CUSTOM_T3} ${USE_ORACLE_IMAGE} ${URL_3RD_DATASOURCE} ${ENABLE_PASSWORDLESS_DB_CONNECTION} ${DB_TYPE} \"}"
--protected-settings "{\"commandToExecute\":\"echo ${acrPassword} ${ORACLE_ACCOUNT_PASSWORD} | bash buildWLSDockerImage.sh ${wlsImagePath} ${acrLoginServer} ${acrUser} ${newImageTag} ${WLS_APP_PACKAGE_URLS} ${ORACLE_ACCOUNT_NAME} ${WLS_CLUSTER_SIZE} ${ENABLE_CUSTOM_SSL} ${ENABLE_ADMIN_CUSTOM_T3} ${ENABLE_CLUSTER_CUSTOM_T3} ${USE_ORACLE_IMAGE} ${URL_3RD_DATASOURCE} ${ENABLE_PASSWORDLESS_DB_CONNECTION} ${DB_TYPE} ${CPU_PLATFORM} \"}"

cleanup_vm
}
Expand Down
Loading