This file contains 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
function Get-Boxstarter { | |
Param( | |
[string] $Version = "2.12.0", | |
[switch] $Force | |
) | |
if(!(Test-Admin)) { | |
$bootstrapperFile = ${function:Get-Boxstarter}.File | |
if($bootstrapperFile) { | |
Write-Host "User is not running with administrative rights. Attempting to elevate..." | |
$command = "-ExecutionPolicy bypass -noexit -command . '$bootstrapperFile';Get-Boxstarter $($args)" |
This file contains 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
def str = ''' | |
pipeline { | |
agent any | |
stages { | |
stage('Hello') { | |
steps { | |
echo 'Hello World' | |
sh 'pwd' | |
} | |
} |
This file contains 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
// reference : https://stackoverflow.com/questions/56294317/how-to-programmatically-get-distribution-id-to-invalidate-cloudfront-cache | |
// prerequisite : aws cli, jq , aws credentials setting | |
pipeline { | |
parameters { | |
stringParam(description: 'your domain name', name: 'domain') | |
} | |
agent any | |
stages{ | |
stage('init'){ | |
steps{ |
This file contains 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
/* | |
jenkins pipeline 의 post directive 에서는 어떤 이유로인지 | |
전역 또는 stage 에서 사용했던 변수나 환경변수의 변경된 값에 접근하지 못합니다. | |
다양하게 시도해본 결과 트릭인듯 하지만 | |
currentBuild.displayName 또는 currentBuild.description 을 이용하여 처리 결과를 저장하여 | |
post 단계에서 slack 등의 툴에 동적인 정보를 전달할 수 있습니다. | |
---- | |
description: If you want to use variable on 'post' directives by storing the result message | |
according to the processing of a specific stage, | |
you can use currentBuild.displayName or currentBuild.description. |
This file contains 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
############################################################################### | |
# Helpful Docker commands and code snippets | |
############################################################################### | |
### CONTAINERS ### | |
docker stop $(docker ps -a -q) #stop ALL containers | |
docker rm -f $(docker ps -a -q) # remove ALL containers | |
docker rm -f $(sudo docker ps --before="container_id_here" -q) # can also filter | |
# exec into container |
This file contains 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
def MIN = 500 // minimum count | |
Jenkins.instance.getAllItems(AbstractProject.class).sort{ it.builds.size() }.reverse().findAll{ it.builds.size() > MIN }.each{ | |
println it.absoluteUrl + "," + it.builds.size() | |
} | |
return |
This file contains 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
pipeline { | |
agent any | |
environment { | |
VAULT_TOKEN = 'YOUR_VAULT_TOKEN' | |
VAULT_API_ADDR = 'YOUR_VAULT_URL/v1' | |
} | |
stages { | |
stage("read vault"){ | |
steps { | |
script{ |
This file contains 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
/* | |
* site healthcheck to slack notification pipeline | |
* | |
*/ | |
pipeline { | |
agent any | |
triggers { | |
pollSCM('H/10 * * * *') // every 10 min | |
} | |
environment { |
This file contains 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
#!/bin/bash | |
set -x | |
set -e | |
# Clone the repo | |
git clone https://github.com/jenkinsci/jenkinsfile-runner.git | |
pushd jenkinsfile-runner |
NewerOlder