Skip to content

Instantly share code, notes, and snippets.

@tnozicka
Last active June 29, 2016 13:02
Show Gist options
  • Save tnozicka/ffabe05e714f8ebe388f1658dc04b3da to your computer and use it in GitHub Desktop.
Save tnozicka/ffabe05e714f8ebe388f1658dc04b3da to your computer and use it in GitHub Desktop.
#!/bin/bash
docker_target=${DOCKER_TAGET:-docker.io/redhatdistortion/}
echo "" | oc login -u system:admin || oc login -u admin -p admin 1>/dev/null && \
oc_registry_url="$(oc get svc docker-registry -n default -o go-template='{{.spec.clusterIP}}'):$(oc get svc docker-registry -n default -o go-template='{{index .spec.ports 0 "port"}}')" && \
oc login -u developer -p developer || oc login -u openshift-dev -p devel 1>/dev/null && \
oc_registry_token=$(oc whoami --token) && \
oc new-project jenkins-slaves 1>/dev/null && \
oc create -f https://github.com/openshift/origin/raw/master/examples/jenkins/master-slave/jenkins-slave-template.json && \
oc process jenkins-slave-builder -v 'IMAGE_NAME=docker.io/tnozicka/openshift-maven-builder,IMAGE_STREAM_NAME=maven,SLAVE_REPO_URL=https://github.com/openshift/origin.git,SLAVE_REPO_CONTEXTDIR=examples/jenkins/master-slave/slave/,SLAVE_REPO_REF=master' | oc create -f - && \
oc process jenkins-slave-builder -v 'IMAGE_NAME=docker.io/tnozicka/openshift-nodejs-builder,IMAGE_STREAM_NAME=nodejs,SLAVE_REPO_URL=https://github.com/openshift/origin.git,SLAVE_REPO_CONTEXTDIR=examples/jenkins/master-slave/slave/,SLAVE_REPO_REF=master' | oc create -f - && \
builds="maven-jenkins-slave nodejs-jenkins-slave" && \
for build in ${builds}; do while true; do oc logs -f ${build}-1-build 2>/dev/null 1>&2; if [ $? -eq 0 ]; then break; fi; done; done && \
oc get is && \
docker login -u '<token>' -p "${oc_registry_token}" -e '[email protected]' ${oc_registry_url} && \
for build in ${builds}; do
docker pull ${oc_registry_url}/jenkins-slaves/${build}:latest && \
docker tag -f ${oc_registry_url}/jenkins-slaves/${build}:latest ${docker_target}${build}:latest
done && \
for build in ${builds}; do
echo "docker push ${docker_target}${build}:latest"
done
#oc process jenkins-slave-builder -v 'IMAGE_NAME=registry.access.redhat.com/jboss-eap-7/eap70-openshift,IMAGE_STREAM_NAME=eap70-openshift,SLAVE_REPO_URL=https://github.com/siamaksade/jenkins-s2i-example.git,SLAVE_REPO_CONTEXTDIR=slave/,SLAVE_REPO_REF=master' | oc create -f - && \
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment