Skip to content

Instantly share code, notes, and snippets.

@rtyler
rtyler / find-ed25519.groovy
Last active Oct 12, 2018
Determine whether there are passphrase-protected ed25519 keys in a Jenkins instance
View find-ed25519.groovy
import com.cloudbees.hudson.plugins.folder.*
import com.cloudbees.hudson.plugins.folder.properties.*
import com.cloudbees.hudson.plugins.folder.properties.FolderCredentialsProvider.FolderCredentialsProperty
import com.cloudbees.plugins.credentials.*
import com.cloudbees.jenkins.plugins.sshcredentials.SSHUserPrivateKey
/* Let's see if the key is ed25518 */
boolean checkKey(def key) {
boolean found = false
View runlocal.sh
#!/bin/sh
exec docker run --rm -ti -p 8080:8080 -e GITHUB_USER=rtyler -v $PWD/init.groovy.d:/var/jenkins_home/init.groovy.d -e CLIENT_SECRET=foobar -e CLIENT_ID=foobar -e AZURE_SUBSCRIPTION_ID=fooar -e AZURE_TENANT_ID=FOOBAR -e AZURE_CLIENT_ID=FOOBAR-e AZURE_CLIENT_SECRET="FOOBAR" rtyler/codevalet-master
View agent.ps1
Set-ExecutionPolicy Unrestricted
$jenkinsServerUrl = $args[0]
$vmName = $args[1]
$secret = $args[2]
$jenkinsSlaveJarUrl = $jenkinsServerUrl + "jnlpJars/slave.jar"
$jnlpUrl=$jenkinsServerUrl + 'computer/' + $vmName + '/slave-agent.jnlp'
$baseDir = 'c:\azurecsdir'
$JDKUrl = 'http://cdn.azul.com/zulu/bin/zulu8.17.0.3-jdk8.0.102-win_x64.zip?jenkins'
View function.json
{
"bindings": [
{
"authLevel": "function",
"type": "httpTrigger",
"direction": "in",
"name": "req"
},
{
"type": "http",
@rtyler
rtyler / 0_console.log
Created Dec 9, 2016
Demonstrating setters/getters in a Pipeline Shared Library
View 0_console.log
Started by user rtyler
Loading library pipeline-library@acme-test
> git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
> git config remote.origin.url git://github.com/jenkins-infra/pipeline-library.git # timeout=10
Fetching upstream changes from git://github.com/jenkins-infra/pipeline-library.git
> git --version # timeout=10
> git fetch --tags --progress git://github.com/jenkins-infra/pipeline-library.git +refs/heads/*:refs/remotes/origin/*
> git rev-parse refs/remotes/origin/acme-test^{commit} # timeout=10
> git rev-parse refs/remotes/origin/origin/acme-test^{commit} # timeout=10
@rtyler
rtyler / 0_error.log
Created Dec 9, 2016
Example of an invalid casing for a Global Variable in a Pipeline Shared Library
View 0_error.log
Started by user rtyler
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
WorkflowScript: 2: unexpected token: Mr Jenkins @ line 2, column 14.
SayHello "Mr Jenkins"
^
1 error
at org.codehaus.groovy.control.ErrorCollector.failIfErrors(ErrorCollector.java:310)
at org.codehaus.groovy.control.ErrorCollector.addFatalError(ErrorCollector.java:150)
View Jenkinsfile
#!/usr/bin/env groovy
node {
stage('Build') {
sh 'make'
}
stage('Test') {
sh 'make check' /* if this returns non-zero, the Pipeline stops */
junit 'reports/**/*.xml'
/* otherwise...we could: */
View Dockerfile
FROM jetty:9-alpine
# Add our system dependencies for running jetty and node services inside the
# container
RUN apk update && apk add supervisor nodejs
# Bring our Java backend app over for Jetty
COPY target/*.war /var/lib/jetty/webapps/ROOT.war
View gist:1200a9c1593df8c54f797b6cbcfebf1a
This file has been truncated, but you can view the full file.
% mvn clean verify
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building plugin-site-api 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:3.0.0:clean (default-clean) @ plugin-site-api ---
[INFO] Deleting /home/tyler/source/github/jenkins-infra/plugin-site/target