Created
April 26, 2017 14:40
-
-
Save jmaitrehenry/7eb2651aaff90738fdbccae74eb1c92b to your computer and use it in GitHub Desktop.
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
| resources: | |
| - name: {{properties['buildName']}}-tpl | |
| properties: | |
| description: '' | |
| properties: | |
| disks: | |
| - autoDelete: true | |
| boot: true | |
| deviceName: boot | |
| initializeParams: | |
| sourceImage: projects/PROJECT/global/images/jenkins-coreos | |
| mode: READ_WRITE | |
| type: PERSISTENT | |
| machineType: n1-standard-4 | |
| networkInterfaces: | |
| - accessConfigs: | |
| - name: external-nat | |
| type: ONE_TO_ONE_NAT | |
| network: global/networks/default | |
| # scheduling: | |
| # preemptible: true | |
| metadata: | |
| items: | |
| - key: user-data | |
| value: | | |
| #cloud-config | |
| write_files: | |
| - path: /tmp/startup.sh | |
| permissions: 0755 | |
| content: | | |
| #!/bin/bash | |
| sleep 10 | |
| export JENKINS_URL='http://JENKINS-URL' | |
| export USER='USER:TOKEN' | |
| export LABELS='{{properties['buildName']}}' | |
| export SLAVE_NAME="{{properties['buildName']}}-`/usr/bin/hostname`" | |
| systemctl stop update-engine | |
| chmod 777 /var/run/docker.sock | |
| mkdir /tmp/jenkins | |
| chmod 777 /tmp/jenkins | |
| docker run -d -v /var/run/docker.sock:/var/run/docker.sock \ | |
| -e JENKINS_URL=$JENKINS_URL \ | |
| -e LABELS=$LABELS \ | |
| -e USER=$USER \ | |
| -e JENKINS_AGENT_NAME=$SLAVE_NAME \ | |
| -e EXECUTORS=1 \ | |
| -v /tmp/jenkins:/tmp/jenkins \ | |
| jmaitrehenry/docker-jenkins-jnlp | |
| coreos: | |
| update: | |
| reboot-strategy: "off" | |
| units: | |
| - name: "jenkins-startup.service" | |
| command: "start" | |
| content: | | |
| [Unit] | |
| Description=Jenkins container | |
| Author=Me | |
| After=docker.service | |
| [Service] | |
| ExecStart=/tmp/startup.sh | |
| type: compute.v1.instanceTemplate | |
| - name: {{properties['buildName']}}-igm | |
| type: compute.v1.instanceGroupManager | |
| properties: | |
| baseInstanceName: {{properties['buildName']}}-igm | |
| instanceTemplate: $(ref.{{properties['buildName']}}-tpl.selfLink) | |
| targetSize: {{properties['targetSize']}} | |
| zone: us-central1-f |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
gce.jinja.schema: