Skip to content

Instantly share code, notes, and snippets.

@slide
slide / Jenkinsfile
Created March 27, 2019 17:52
groovy var
def groovyVar = 'test'
pipeline {
agent any
options {
timestamps()
ansiColor('xterm')
<buildWrappers>
<ruby-proxy-object>
<ruby-object ruby-class="Jenkins::Tasks::BuildWrapperProxy" pluginid="ci-skip">
<object ruby-class="CiSkipWrapper" pluginid="ci-skip">
<ci__skip ruby-class="NilClass" pluginid="ci-skip"/>
</object>
<pluginid pluginid="ci-skip" ruby-class="String">ci-skip</pluginid>
</ruby-object>
</ruby-proxy-object>
</buildWrappers>
# Image publish: MicrosoftWindowsServer
# Image offer: WindowsServer
# Image Sku: 2019-Datacenter-with-Containers
# Init Script:
Set-ExecutionPolicy Unrestricted
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
$baseDir = 'c:\azurecsdir'
Sending build context to Docker daemon 15.36kB
Step 1/2 : FROM pester-jenkins-windows
---> 98a07a54cbc5
Step 2/2 : RUN java -jar C:/ProgramData/Jenkins/plugin-management-cli.jar --plugins maven-plugin:2.7.1 ant:1.3 mesos:0.13.0 git:latest filesystem_scm:experimental docker:1.1.6
---> Running in eaff8f4d57e0
No file containing list of plugins to be downloaded entered.
No directory to download plugins entered. Will use default of C:\ProgramData\Jenkins\Reference\Plugins
Using update center https://updates.jenkins.io from JENKINS_UC environment variable
Using experimental update center https://updates.jenkins.io/experimental from JENKINS_UC_EXPERIMENTAL environemnt variable
Using incrementals mirror https://repo.jenkins-ci.org/incrementals from JENKINS_INCREMENTALS_REPO_MIRROR environment variable
Step 2/3 : RUN java -jar C:/ProgramData/Jenkins/plugin-management-cli.jar --plugins maven-plugin:2.7.1 ant:1.3 mesos:0.13.0 git:latest filesystem_scm:experimental docker:1.1.6 ; Write-Host "lastExitCode = $lastExitCode" ; exit $lastExitCode
---> Running in bf57c519b516
No file containing list of plugins to be downloaded entered.
No directory to download plugins entered. Will use default of C:\ProgramData\Jenkins\Reference\Plugins
Using update center https://updates.jenkins.io from JENKINS_UC environment variable
Using experimental update center https://updates.jenkins.io/experimental from JENKINS_UC_EXPERIMENTAL environemnt variable
Using incrementals mirror https://repo.jenkins-ci.org/incrementals from JENKINS_INCREMENTALS_REPO_MIRROR environment variable
No war entered. Will use default of C:\ProgramData\Jenkins\jenkins.war
War bundled plugins:
@echo off
setlocal enableextensions
echo.
::Do a little environment variable shuffling to ensure we have a capital IP_ROOT set in this process
::and not a lower case variant as would be in the case when launched from mstest or vs (a bug)
if defined IP_ROOT (
set IP_ROOT_BACKUP=%IP_ROOT%
set IP_ROOT=
)
Step 2/2 : RUN java -jar C:/ProgramData/Jenkins/plugin-management-cli.jar --plugins maven-plugin:2.7.1 ant:1.3 mesos:0.13.0 git:latest filesystem_scm:experimental docker:1.1.6
---> Running in 5d97e16a0f1d
No .txt file containing list of plugins to be downloaded entered.
No .yaml file containing list of plugins to be downloaded entered.
No directory to download plugins entered. Will use default of C:\ProgramData\Jenkins\Reference\Plugins
Using update center https://updates.jenkins.io from JENKINS_UC environment variable
Using experimental update center https://updates.jenkins.io/experimental from JENKINS_UC_EXPERIMENTAL environment variable
Using incrementals mirror https://repo.jenkins-ci.org/incrementals from JENKINS_INCREMENTALS_REPO_MIRROR environment variable
No war entered. Will use default of C:\ProgramData\Jenkins\jenkins.war
# Init Script:
Set-ExecutionPolicy Unrestricted
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
$baseDir = 'c:\azurecsdir'
$JDKUrl = 'https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.3%2B7/OpenJDK11U-jre_x64_windows_hotspot_11.0.3_7.zip'
$destinationJDKZipPath = "$baseDir\adoptOpenJDK.zip"
$javaHome = "$baseDir\jdk-11.0.3+7-jre"
New-Item -ItemType Directory -Path $('{0}/{1}' -f $env:WARDIR,$env:VERSION)
New-Item -ItemType Directory -Path $env:WAR_WEBDIR
$sha256 = (Get-FileHash -Algorithm SHA256 -Path $_.FullName).Hash.ToString().ToLower()
Set-Content -Path $env:WAR_SHASUM -Value $sha256
Write-Host $sha256
Copy-Item $env:WAR $('{0}/{1}/{2}.war' -f $env:WARDIR,$env:VERSION,$ARTIFACTNAME)
Copy-Item $env:WAR_SHASUM $('{0}/{1}' -f $env:WARDIR,$env:VERSION)
def SERVICE = ""
pipeline {
agent any
stages {
stage("Web UI - Choose service") {
steps {
script {
def service = input(
message: 'Select the packages you\'d like to deploy',