Skip to content

Commit

Permalink
Merge branch 'xc-112754' into 'main'
Browse files Browse the repository at this point in the history
OCNE: Add ItWlsDomainOnPVSample and ItFmwDomainOnPVSample test into OCNE Environment

See merge request weblogic-cloud/weblogic-kubernetes-operator!4463
  • Loading branch information
rjeberhard committed Oct 16, 2023
2 parents a770b95 + 814ad80 commit 688547b
Show file tree
Hide file tree
Showing 8 changed files with 119 additions and 32 deletions.
86 changes: 62 additions & 24 deletions Jenkinsfile.ocne
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
//

CRON_SETTINGS = '''H 1 * * * % MAVEN_PROFILE_NAME=olcne-srg
H 8 * * * % MAVEN_PROFILE_NAME=olcne-mrg'''
H 5 * * * % MAVEN_PROFILE_NAME=olcne-mrg
H 14 * * * % MAVEN_PROFILE_NAME=olcne-sequential'''

pipeline {
agent { label 'large' }
Expand All @@ -13,7 +14,7 @@ pipeline {
}
triggers {
// timer trigger for "nightly build"
parameterizedCron(env.JOB_NAME == 'wko-ocne-main-nightly-new' ?
parameterizedCron(env.JOB_NAME == 'wko-ocne-main-nightly' ?
CRON_SETTINGS : '')
}

Expand All @@ -34,7 +35,8 @@ pipeline {
oci_profile = 'DEFAULT'
jenkins_user = sh(returnStdout: true, script: "id -nu").trim()
jenkins_home_directory = sh(returnStdout: true, script: "getent passwd ${jenkins_user} | cut -d: -f6").trim()

OCI_CLI_CONFIG_FILE = "${jenkins_home_directory}/.oci/config"

oci_config_file_creds = 'wkt-oci-config-file'
oci_signing_key_creds = 'wkt-oci-signing-key'

Expand All @@ -53,15 +55,15 @@ pipeline {
result_root = "${outdir}/wl_k8s_test_results"
pv_root_parent = "${outdir}/k8s-pvroot"
pv_root = "${pv_root_parent}/newpvroot"
pv_root_for_sampletest = "/shared"

start_time = sh(script: 'date +"%Y-%m-%d %H:%M:%S"', returnStdout: true).trim()
wle_download_url="https://github.com/oracle/weblogic-logging-exporter/releases/latest"

CLUSTER_NAME = "${env.JOB_NAME == 'wko-ocne-main-nightly-new' ? 'mycluster1' : 'mycluster1'}"
CLUSTER_NAME = "${env.JOB_NAME == 'wko-ocne-main-nightly' ? 'mycluster1' : 'mycluster1'}"
kubeconfig_file = "${WORKSPACE}/ocne_kubeconfig1"
//MAVEN_PROFILE_NAME = "${env.JOB_NAME == 'wko-ocne-main-nightly-new' ? 'olcne-srg' : 'olcne-mrg'}"
availability_domain = "${env.JOB_NAME == 'wko-ocne-main-nightly-new' ? 'mFEn:PHX-AD-1' : 'mFEn:PHX-AD-1'}"
PARALLEL_RUN = "${env.JOB_NAME == 'wko-ocne-main-nightly-new' ? true : false}"
availability_domain = "${env.JOB_NAME == 'wko-ocne-main-nightly' ? 'mFEn:PHX-AD-1' : 'mFEn:PHX-AD-1'}"
PARALLEL_RUN = "${env.JOB_NAME == 'wko-ocne-main-nightly' ? true : false}"
}

parameters {
Expand All @@ -76,6 +78,7 @@ pipeline {
choices: [
'olcne-srg',
'olcne-mrg',
'olcne-sequential',
'integration-tests'
]
)
Expand Down Expand Up @@ -254,6 +257,21 @@ pipeline {
}
}

stage('Setup OCI config file ') {

steps {
withCredentials([file(credentialsId: "${oci_config_file_creds}", variable: 'OCI_CONFIG_FILE'),
file(credentialsId: "${oci_signing_key_creds}", variable: 'OCI_SIGNING_KEY')]) {
sh "mkdir -p ${jenkins_home_directory}/.oci"
sh "sed -e \"s:__jenkins_home__:${jenkins_home_directory}:g\" \"\$OCI_CONFIG_FILE\" > ${jenkins_home_directory}/.oci/config"
sh "cp \"\$OCI_SIGNING_KEY\" ${jenkins_home_directory}/.oci/oci-signing-key.pem"
}
sh '''
cat ${jenkins_home_directory}/.oci/config
'''
}
}

stage('Build WebLogic Kubernetes Operator') {

steps {
Expand All @@ -265,12 +283,21 @@ pipeline {

stage('Preparing Integration Test Environment') {
steps {
sh 'mkdir -m777 -p ${result_root}'
echo "Results will be in ${result_root}"
sh 'mkdir -m777 -p ${pv_root_parent}'
sh 'sudo mount 100.105.4.71:/fs-ocne-test ${pv_root_parent}'
sh 'mkdir -m777 -p ${pv_root}'
echo "Persistent volume files, if any, will be in ${pv_root}"
sh '''

mt_privateip_id=`oci fs mount-target list --compartment-id=${compartment_id} --display-name="mt-ocne-test" --availability-domain=${availability_domain} | jq -r '.data[] | ."private-ip-ids"[]'`
mt_private_ip=`oci network private-ip get --private-ip-id "${mt_privateip_id}" | jq -r '.data | ."ip-address"'`

mkdir -m777 -p ${result_root}
echo "Results will be in ${result_root}"
mkdir -m777 -p ${pv_root_parent}
sudo mount ${mt_private_ip}:/fs-ocne-test ${pv_root_parent}
mkdir -m777 -p ${pv_root}
echo "Persistent volume files, if any, will be in ${pv_root}"
echo "Create pv root for sample test in ${pv_root_for_sampletest}"
sudo mkdir -m777 -p ${pv_root_for_sampletest}
sudo mount ${mt_private_ip}:/fs-ocne-test ${pv_root_for_sampletest}
'''
}
}

Expand All @@ -279,6 +306,10 @@ pipeline {

sh '''
#################

k8s_master_instance_id=`oci compute instance list --compartment-id=${compartment_id} --display-name=ocne-new2 |jq -r '.data[]."id"'`
k8s_master_instance_private_ip=`oci compute instance list-vnics --compartment-id=${compartment_id} --instance-id=${k8s_master_instance_id} |jq -r '.data[]."private-ip"'`

echo "Generating kubeconfig file"

cat > $kubeconfig_file <<EOF
Expand All @@ -287,7 +318,7 @@ apiVersion: v1
clusters:
- cluster:
certificate-authority-data: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUMvakNDQWVhZ0F3SUJBZ0lCQURBTkJna3Foa2lHOXcwQkFRc0ZBREFWTVJNd0VRWURWUVFERXdwcmRXSmwKY201bGRHVnpNQjRYRFRJek1Ea3lNekF5TXpZeU1Gb1hEVE16TURreU1EQXlNell5TUZvd0ZURVRNQkVHQTFVRQpBeE1LYTNWaVpYSnVaWFJsY3pDQ0FTSXdEUVlKS29aSWh2Y05BUUVCQlFBRGdnRVBBRENDQVFvQ2dnRUJBT2NzCkxucXZreE56Y1ZIS292SW5mMXQ0OHJ1d3BQU215ZjE5NHMvdDB4OG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JhTVZsT2dDUm10dU5ydTFiZ2MKTWpVPQotLS0tLUVORCBDRVJUSUZJQ0FURS0tLS0tCg==
server: https://100.105.4.76:6443
server: https://${k8s_master_instance_private_ip}:6443
name: kubernetes
contexts:
- context:
Expand Down Expand Up @@ -343,14 +374,16 @@ EOF
fi

export PATH=${runtime_path}
export OCI_CLI_CONFIG_FILE=${jenkins_home_directory}/.oci/config
export OCI_CLI_PROFILE=${oci_profile}
compartment_ocid=${compartment_id}
mkdir -m777 -p "${WORKSPACE}/.mvn"
touch ${WORKSPACE}/.mvn/maven.config
export KUBECONFIG=${kubeconfig_file}

clusterIP='100.105.4.76'
k8s_master_instance_id=`oci compute instance list --compartment-id=${compartment_id} --display-name=ocne-new2 |jq -r '.data[]."id"'`
k8s_master_instance_private_ip=`oci compute instance list-vnics --compartment-id=${compartment_id} --instance-id=${k8s_master_instance_id} |jq -r '.data[]."private-ip"'`

clusterIP=${k8s_master_instance_private_ip}
export NO_PROXY=$NO_PROXY,${clusterIP}
echo "NO_PROXY:" $NO_PROXY

Expand All @@ -359,13 +392,12 @@ EOF
if [ -n "${IT_TEST}" ]; then
echo "-Dit.test=\"${IT_TEST}\"" >> ${WORKSPACE}/.mvn/maven.config
fi
if [ "${MAVEN_PROFILE_NAME}" == "olcne-srg" ]; then
if [ "${MAVEN_PROFILE_NAME}" == "olcne-sequential" ]; then
PARALLEL_RUN='false'
fi
if [ "${MAVEN_PROFILE_NAME}" == "olcne-mrg" ]; then
PARALLEL_RUN='true'
fi

echo "MAVEN_PROFILE_NAME:" $MAVEN_PROFILE_NAME
echo "PARALLEL_RUN:" $PARALLEL_RUN
echo "-Dwko.it.wle.download.url=\"${wle_download_url}\"" >> ${WORKSPACE}/.mvn/maven.config
echo "-Dwko.it.result.root=\"${result_root}\"" >> ${WORKSPACE}/.mvn/maven.config
echo "-Dwko.it.pv.root=\"${pv_root}\"" >> ${WORKSPACE}/.mvn/maven.config
Expand Down Expand Up @@ -402,13 +434,17 @@ EOF
usernamePassword(credentialsId: "${ocir_creds}", usernameVariable: 'OCIR_USER', passwordVariable: 'OCIR_PASS')
]) {
sh '''

k8s_master_instance_id=`oci compute instance list --compartment-id=${compartment_id} --display-name=ocne-new2 |jq -r '.data[]."id"'`
k8s_master_instance_private_ip=`oci compute instance list-vnics --compartment-id=${compartment_id} --instance-id=${k8s_master_instance_id} |jq -r '.data[]."private-ip"'`

export HTTPS_PROXY='http://www-proxy-hqdc.us.oracle.com:80'
export https_proxy='http://www-proxy-hqdc.us.oracle.com:80'
export HTTP_PROXY='http://www-proxy-hqdc.us.oracle.com:80'
export http_proxy='http://www-proxy-hqdc.us.oracle.com:80'
#100.105.4.76 is the ip address of kubernetes master node
export NO_PROXY='localhost,127.0.0.1,.us.oracle.com,.oraclecorp.com,/var/run/docker.sock,100.105.4.76'
export no_proxy='localhost,127.0.0.1,.us.oracle.com,.oraclecorp.com,/var/run/docker.sock,100.105.4.76'

export NO_PROXY="localhost,127.0.0.1,.us.oracle.com,.oraclecorp.com,/var/run/docker.sock,${k8s_master_instance_private_ip}"
export no_proxy="localhost,127.0.0.1,.us.oracle.com,.oraclecorp.com,/var/run/docker.sock,${k8s_master_instance_private_ip}"
export PATH=${runtime_path}
export OKE_CLUSTER="false"
export OCNE="true"
Expand Down Expand Up @@ -438,7 +474,6 @@ EOF
sh '''
export PATH="${WORKSPACE}/bin:${PATH}"
export KUBECONFIG=${kubeconfig_file}
export OCI_CLI_CONFIG_FILE=${WORKSPACE}/oci/config
export OCI_CLI_PROFILE=${oci_profile}
mkdir -m777 -p ${result_root}/kubelogs
mkdir -m777 -p "${WORKSPACE}/logdir/${BUILD_TAG}/wl_k8s_test_results"
Expand All @@ -465,6 +500,9 @@ EOF
rm -rf ${WORKSPACE}/.mvn
sudo rm -rf ${pv_root}
sudo umount ${pv_root_parent}
sudo rm -rf ${pv_root_for_sampletest}/domains
sudo rm -rf ${pv_root_for_sampletest}/logs
sudo umount ${pv_root_for_sampletest}
kubectl delete pod $(kubectl get pod |grep recycler-for|awk '{print $1}') || true
'''
}
Expand Down
7 changes: 7 additions & 0 deletions integration-tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -665,6 +665,13 @@
<groups>olcne-srg</groups>
</properties>
</profile>
<profile>
<id>olcne-sequential</id>
<properties>
<skipITs>false</skipITs>
<groups>olcne-sequential</groups>
</properties>
</profile>
<profile>
<id>olcne-mrg</id>
<properties>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,14 @@
import static oracle.weblogic.kubernetes.TestConstants.DB_IMAGE_TAG;
import static oracle.weblogic.kubernetes.TestConstants.FMWINFRA_IMAGE_TAG;
import static oracle.weblogic.kubernetes.TestConstants.FMWINFRA_IMAGE_TO_USE_IN_SPEC;
import static oracle.weblogic.kubernetes.TestConstants.IMAGE_NAME_OPERATOR;
import static oracle.weblogic.kubernetes.TestConstants.K8S_NODEPORT_HOST;
import static oracle.weblogic.kubernetes.TestConstants.KIND_CLUSTER;
import static oracle.weblogic.kubernetes.TestConstants.KIND_REPO;
import static oracle.weblogic.kubernetes.TestConstants.OCNE;
import static oracle.weblogic.kubernetes.TestConstants.OKD;
import static oracle.weblogic.kubernetes.TestConstants.RESULTS_ROOT;
import static oracle.weblogic.kubernetes.TestConstants.TEST_IMAGES_PREFIX;
import static oracle.weblogic.kubernetes.TestConstants.TEST_IMAGES_REPO_SECRET_NAME;
import static oracle.weblogic.kubernetes.TestConstants.TRAEFIK_INGRESS_IMAGE_NAME;
import static oracle.weblogic.kubernetes.TestConstants.TRAEFIK_INGRESS_IMAGE_REGISTRY;
Expand Down Expand Up @@ -65,6 +68,7 @@
@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
@IntegrationTest
@Tag("kind-sequential")
@Tag("olcne-sequential")
@DisabledIfEnvironmentVariable(named = "SKIP_WLS_SAMPLES", matches = "true")
class ItFmwDomainOnPVSample {

Expand Down Expand Up @@ -130,6 +134,13 @@ public static void initAll(@Namespaces(4) List<String> namespaces) {
envMap.put("K8S_NODEPORT_HOST", K8S_NODEPORT_HOST);
envMap.put("OKD", "" + OKD);
envMap.put("KIND_CLUSTER", "" + KIND_CLUSTER);
envMap.put("OCNE", "" + OCNE);

if (OCNE) {
envMap.put("OPER_IMAGE_NAME", TEST_IMAGES_PREFIX + IMAGE_NAME_OPERATOR);
envMap.put("DOMAIN_CREATION_IMAGE_NAME", TEST_IMAGES_PREFIX + DOMAIN_CREATION_IMAGE_NAME);
envMap.put("DB_IMAGE_PULL_SECRET", BASE_IMAGES_REPO_SECRET_NAME);
}

// kind cluster uses openjdk which is not supported by image tool
if (WIT_JAVA_HOME != null) {
Expand Down Expand Up @@ -219,10 +230,15 @@ public void testInitialImage() {
execTestScriptAndAssertSuccess("-initial-image", "Failed to run -initial-image");

// load the image to kind if using kind cluster
String imageCreated;
if (KIND_REPO != null) {
String imageCreated = DOMAIN_CREATION_IMAGE_NAME + ":" + DOMAIN_CREATION_IMAGE_JRF_TAG;
imageCreated = DOMAIN_CREATION_IMAGE_NAME + ":" + DOMAIN_CREATION_IMAGE_JRF_TAG;
logger.info("loading image {0} to kind", imageCreated);
imagePush(imageCreated);
} else if (OCNE) {
imageCreated = TEST_IMAGES_PREFIX + DOMAIN_CREATION_IMAGE_NAME + ":" + DOMAIN_CREATION_IMAGE_JRF_TAG;
logger.info("pushing image {0} to repo", imageCreated);
imagePush(imageCreated);
}
}

Expand Down Expand Up @@ -293,7 +309,7 @@ public static void tearDownAll() {
if (traefikNamespace != null) {
logger.info("Uninstall Traefik");
String command =
"helm uninstall " + TRAEFIK_RELEASE_NAME + "-" + traefikNamespace.substring(3) + " -n " + traefikNamespace;
"helm uninstall " + envMap.get("TRAEFIK_NAME") + " -n " + traefikNamespace;
Command.withParams(new CommandParams()
.command(command)
.redirect(true)).execute();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@
import static oracle.weblogic.kubernetes.TestConstants.K8S_NODEPORT_HOST;
import static oracle.weblogic.kubernetes.TestConstants.KIND_REPO;
import static oracle.weblogic.kubernetes.TestConstants.KUBERNETES_CLI;
import static oracle.weblogic.kubernetes.TestConstants.OCNE;
import static oracle.weblogic.kubernetes.TestConstants.TEST_IMAGES_PREFIX;
import static oracle.weblogic.kubernetes.TestConstants.WEBLOGIC_IMAGE_NAME;
import static oracle.weblogic.kubernetes.TestConstants.WEBLOGIC_IMAGE_NAME_DEFAULT;
import static oracle.weblogic.kubernetes.TestConstants.WEBLOGIC_IMAGE_TO_USE_IN_SPEC;
Expand Down Expand Up @@ -730,6 +732,9 @@ void testUpdateImageName() {

String kindWlsImage = KIND_REPO + WEBLOGIC_IMAGE_NAME_DEFAULT;
String testWlsImage = DOMAIN_IMAGES_PREFIX + WEBLOGIC_IMAGE_NAME_DEFAULT;
if (OCNE) {
testWlsImage = TEST_IMAGES_PREFIX + "weblogic";
}
//change image name to imageUpdate
String imageTag = CommonTestUtils.getDateAndTimeStamp();
String imageUpdate = KIND_REPO != null
Expand Down Expand Up @@ -1036,7 +1041,6 @@ private static void createDomain() {
logger.info("Creating cluster resource {0} in namespace {1}",clusterResName, introDomainNamespace);
createClusterAndVerify(cluster);


// create a domain custom resource configuration object
logger.info("Creating domain custom resource");
DomainResource domain = new DomainResource()
Expand Down
Loading

0 comments on commit 688547b

Please sign in to comment.