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); |
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
| KubernetesMockClient mock = new KubernetesMockClient(); | |
| //Define the behaviour | |
| mock.services().inNamespace(or("default","fabric8")).withName("fabric8-console-service").get().andReturn( | |
| new ServiceBuilder() | |
| .withNewMetadata().withName("fabric8-console-service").endMetadata() | |
| .withNewSpec() | |
| .addNewPort() | |
| .withProtocol("TCP") | |
| .withPort(80) |
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
| KubernetesClient client = new DefaultKubernetesClinet(); | |
| OpenShiftClient oc = client.adapt(OpenShiftClient.class); |