This file contains hidden or 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 | |
| function cleanup { | |
| echo "Cleaning Up!" | |
| echo "Container $HOSTNAME exited" > /path/to/volume | |
| } | |
| echo "My pid is $$" | |
| trap 'kill ${!}; cleanup' SIGTERM | |
| trap 'kill ${!}; cleanup' SIGKILL |
This file contains hidden or 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 | |
| IN=`echo $1 | base64` | |
| SUFFIX="::::MAGIC::::" | |
| MASTER_KEY=`cat /var/jenkins_home/secrets/master.key` | |
| HASHED_MASTER_KEY=`echo -n $MASTER_KEY | sha256sum | cut -d " " -f 1` | |
| HASHED_MASTER_KEY_16=${HASHED_MASTER_KEY:0:16} | |
| openssl enc -d -aes-128-ecb -in /var/jenkins_home/secrets/hudson.util.Secret -K $HASHED_MASTER_KEY -out /tmp/hudson.key | |
| HUDSON_KEY=`cat /tmp/hudson.key` | |
| HUDSON_KEY_TRIMMED=${HUDSON_KEY:0:-16} | |
| HUDSON_KEY_16=${HUDSON_KEY_TRIMMED:0:16} |
This file contains hidden or 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
| node('docker') { | |
| docker.image('maven').inside { | |
| git 'https://github.com/fabric8io/example-camel-cdi' | |
| sh 'mvn clean install' | |
| } | |
| } |
This file contains hidden or 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
| import jenkins.model.* | |
| import com.cloudbees.plugins.credentials.* | |
| import com.cloudbees.plugins.credentials.common.* | |
| import com.cloudbees.plugins.credentials.domains.* | |
| import com.cloudbees.plugins.credentials.impl.* | |
| import com.cloudbees.jenkins.plugins.sshcredentials.impl.* | |
| import hudson.plugins.sshslaves.*; | |
| domain = Domain.global() | |
| store = Jenkins.instance.getExtensionList('com.cloudbees.plugins.credentials.SystemCredentialsProvider')[0].getStore() |
This file contains hidden or 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
| #Generate master.key and secret | |
| MAGIC="::::MAGIC::::" | |
| mkdir -p /var/jenkins_home/secrets | |
| openssl rand -hex 128 > /var/jenkins_home/secrets/master.key | |
| openssl dgst -sha256 -binary /var/jenkins_home/secrets/master.key > /tmp/master.hashed | |
| HEX_MASTER_KEY=`head -c 16 /tmp/master.hashed | xxd -l 16 -p` | |
| openssl rand 259 > /tmp/base | |
| echo $MAGIC >> /tmp/base | |
| openssl enc -aes-128-ecb -in /tmp/base -K $HEX_MASTER_KEY -out /var/jenkins_home/secrets/hudson.util.Secret |
This file contains hidden or 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
| { | |
| "volumeMounts": [ | |
| { | |
| "name": "docker-socket", | |
| "mountPath": "/var/run/docker.sock", | |
| "readOnly": false | |
| } | |
| ], | |
This file contains hidden or 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 | |
| KUBERNETES=https://$KUBERNETES_SERVICE_HOST:$KUBERNETES_SERVICE_PORT | |
| TOKEN=`cat /var/run/secrets/kubernetes.io/serviceaccount/token` | |
| POD=`hostname` | |
| curl -s -k -H "Authorization: Bearer $TOKEN" $KUBERNETES/api/v1/namespaces/$KUBERNETES_NAMESPACE/pods/$POD | grep -i hostIp | cut -d "\"" -f 4 |
This file contains hidden or 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
| java -jar /path/to/swarm-client.jar http://jenkins.master:8080 |
This file contains hidden or 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
| //Openshift client with custom config | |
| OpenshiftConfig config = new OpenshiftConfigBuilder() | |
| .withMasterUrl(url) | |
| .withOpenShiftUrl(openshiftUrl) | |
| .withTrustCerts(true) | |
| .build(); | |
| OpenshiftClient client = new DefaultOpenshiftClient(config); |
This file contains hidden or 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
| //Client with custom config | |
| Config config = new ConfigBuilder() | |
| .withMasterUrl(url) | |
| .withTrustCerts(true) | |
| .withOauthToken(mytoken) | |
| .build(); | |
| KubernetesClient = new DefaultKubernetesClient(config); |