Before You Begin
This 20-minute tutorial shows you how to automate updating the domain configuration with WebLogic Deploy Tooling (WDT) artifacts on a public project in Jenkins.
Background
Oracle WebLogic Server for Oracle Cloud Infrastructure
Container Engine for Kubernetes (OKE) uses the Jenkins pipeline
update domain
job to update the domain
configuration and deploys applications, shared libraries, and
resources to the new domain. In the update domain
job, you specify the location of the WDT archive zip file,
domain model Yaml and variables properties file using File
Upload, Object Storage, or the Shared File System, and build the
job.
You can also update the domain configuration using Jenkins Maven project in Oracle WebLogic Server for OKE if you have an application source code and build automation scripts in a git repository. You must have installed Maven before you create a Maven project.
Once you setup the application source code with build and automation scripts in the GitHub repository, you can update the domain configuration by creating a Maven project on Jenkins using source code and then create a pipeline job that triggers the Maven project.
The source code triggers the build system using the GitHub URL
and branch name and then copies the WDT archive zip file and
model YAML to the shared filed system (/u01/shared
),
and the pipeline job invokes the Maven project and the existing
update domain
job in Oracle WebLogic Server for OKE
to update the domain configuration.
Then, using these pipeline jobs, you can build the application
war
or ear
file and invoke the
Jenkins pipeline update domain
job to deploy the
application to an Oracle WebLogic Server for OKE instance.
This tutorial offers you the ability to use Oracle WebLogic Server for OKE to update WebLogic domain from an application source in a git repository, and create and run Jenkins pipelines with ready-to-use automation scripts provided by Oracle.
What Do You Need?
- A stack provisioned using the Resource Manager
- A GitHub repository with the following files:
model
directory withmodel.yaml
- a sample-app directory that contains:
- assembly for the maven build
wlsdeploy
directory that includes web application, sample app, JMS messaging app and thehelloworld
war filepom.xml
The directory structure is as follows:

- An application source code with build and automation scripts in a GitHub repository
Configure
Maven on Jenkins
If you have configured Maven on Jenkins, you can proceed to the next section.
- Sign in to the Jenkins console for your domain. See Access
the Jenkins Console.
- On the Dashboard page, click Manage Jenkins, and then click Global Tool Configuration.
- Under Maven, click Add Maven.
- Enter a Name for the installation.
- Select the Version of Maven to install and click Save.
Create
a Maven project Using Source Code Management
- Sign in to the Jenkins console for your domain. See Access
the Jenkins Console.
- On the Dashboard page, click New Item.
- Select Maven project from the list of
items, and in the Enter an item name field,
enter the item name,
build_repo
, and click Save. - On the Source Code Management tab, for GitHub
project, in the Project URL
field, enter the git repository URL of the GitHub project that
you created. The project URL format is:
https://github.com/user/repo
. - On the Source Code Management tab, select Git and do the following:
- For
Repository URL, enter the git repository
URL of the GitHub project that you created. For
example,
https://gitHub.com/user/repo
. - For Branch Specifier, enter the name of the branch (working directory).
- On the Build tab, do the following.
- For
ROOT POM, enter the pom file that you
created in GitHub.
If the pom.xml is not located in the root directory, specify the path.
- For
Goals and options, enter the goals that you
want to execute within this project. Example:
clean install
. - Click Apply.
- On the Dashboard page, click the
build_repo
job and click Build Now.
update domain
job to pick up the archive zip and model Yaml from workspace folder/u01/shared
/var/jenkins_home/jobs/build_repo/workspace
location. For practical purposes, the artifacts are not uploaded to a repository.
For example, based on the
sample directory structure, the location of the pom file is
sample-app/pom.xml
.
Create
a Pipeline Job Using a Script
- In the Jenkins console, on the Dashboard page, click New Item.
- Select Pipeline
from the list of items, and in the Enter an item
name field, enter the item name,
build_repo update domain
, and click OK. - On the Advanced Project Options tab, enter the following script:
- Click Apply.
- On the Dashboard page, click
the
build_repo update domain
job and click Build Now.
To create this pipeline job, you
must provide the pipeline script. This script wraps the build_repo
and the update domain
jobs in a stage and runs
the build. You can view the stages when the job is in
progress.
Note: If
your WDT archive file contains the variable properties file,
under parameters
, you must add Variable_Source
and Variable_File_Location
. You must update
the location of wdt_archive.zip, model.yaml and domain name
based on your environment.
def ARGS = "" pipeline { agent { node { label 'agent-label' } } options { skipStagesAfterUnstable() disableConcurrentBuilds() timestamps() warnError('Pipeline error caught') } environment { BUILD_TS = getBuildTimestamp() } stages { stage('Build') { steps { build 'build_repo' } } stage('Update Domain') { steps { build job: 'update domain', parameters: [ string(name: 'Archive_File_Location', value: "/u01/shared/archive.zip"), string(name: 'Archive_Source', value:"Shared File System"), string(name: 'Model_File_Location', value: "/u01/shared/model.yaml"), string(name: 'Domain_Model_Source', value:"Shared File System"), string(name: 'Domain_Name', value:"myDomain"), string(name: 'Rollback_On_Failure', value: "true"), ] } } } } /** * Generating build timestamp. * This will be used to tag the updated domain docker image. */ def getBuildTimestamp() { Date date = new Date() buildTimestamp = date.format('yy-MM-dd_HH-mm-ss') println("Generated Build Timestamp: " + buildTimestamp) return buildTimestamp }