The document quality of Google Cloud is far away if compare with AWS. Here is a sample.
If you met below error, when running packer or other SDK,
$ cat packer.json
{
"builders": [
The document quality of Google Cloud is far away if compare with AWS. Here is a sample.
If you met below error, when running packer or other SDK,
$ cat packer.json
{
"builders": [
| #!/bin/bash | |
| docker run -d -p 80:80 -p 443:443 --name rancher-server rancher/rancher:latest | |
| while ! curl -k https://localhost/ping; do sleep 3; done | |
| # Login | |
| LOGINRESPONSE=`curl -s 'https://127.0.0.1/v3-public/localProviders/local?action=login' -H 'content-type: application/json' --data-binary '{"username":"admin","password":"admin"}' --insecure` | |
| LOGINTOKEN=`echo $LOGINRESPONSE | jq -r .token` | |
| # Change password |
| --- | |
| kind: ClusterRole | |
| apiVersion: rbac.authorization.k8s.io/v1 | |
| metadata: | |
| name: staging-node-user | |
| rules: | |
| - apiGroups: [""] | |
| resources: ["nodes"] | |
| verbs: ["get", "list", "watch"] | |
| - apiGroups: [""] |
| #!/usr/bin/python3 | |
| """ | |
| Script that creates Personal Access Token for Gitlab API; | |
| Tested with: | |
| - Gitlab Community Edition 10.1.4 | |
| - Gitlab Enterprise Edition 12.6.2 | |
| - Gitlab Enterprise Edition 13.4.4 | |
| """ | |
| import sys | |
| import requests |
| variable "length" { | |
| default = "20" | |
| } | |
| resource "random_id" "password" { | |
| byte_length = "${var.length * 3 / 4}" | |
| } | |
| output "password" { | |
| value = "${random_id.password.b64}" |
| #!/usr/bin/env sh | |
| docker-machine rm -f rancher host1 | |
| docker-machine create rancher --driver virtualbox --virtualbox-cpu-count "-1" --virtualbox-disk-size "8000" --virtualbox-memory "512" --virtualbox-boot2docker-url=https://github.com/boot2docker/boot2docker/releases/download/v1.11.2/boot2docker.iso | |
| docker-machine scp scripts/rancher-net.sh rancher:. | |
| docker-machine ssh rancher sh rancher-net.sh | |
| docker-machine regenerate-certs rancher -f | |
| eval $(docker-machine env rancher) | |
| docker-compose up -d | |
| eval $(docker-machine env -u) | |
| docker-machine create host1 --driver virtualbox --virtualbox-cpu-count "-1" --virtualbox-disk-size "54000" --virtualbox-memory "2048" --virtualbox-boot2docker-url=https://github.com/boot2docker/boot2docker/releases/download/v1.11.2/boot2docker.iso |
| docker.image('cloudbees/java-build-tools:0.0.6').inside { | |
| sshagent(['github-ssh-credentials']) { | |
| sh """ | |
| git version | |
| git config --local user.email \\"[email protected]\\" | |
| git config --local user.name \\"Cyrille Le Clerc\\" | |
| git clone [email protected]:cyrille-leclerc/a-test-repo.git | |
| date &> now.txt |
This is pretty simple snippet to get API Token of a user , lets say "MYUser" in jenkins.
its pretty useful when you are working with 'jenkins-job-builder' to update jobs in jenkins,
and you need to get the api token which JJB needs inorder to update jobs to ..
run this code in either jenkins script console , or as i prefer, in form of init.groovy.
so when jenkins master starts, i create a user for JJb.
after that i get the token right away and pass it to my JJB jobs folder to file 'jenkins_jobs.ini' :)_ .
///////////////////////////////////////////////////////////////////////| #!/usr/bin/env python2 | |
| import SimpleHTTPServer | |
| import SocketServer | |
| import logging | |
| PORT = 8000 | |
| class GetHandler(SimpleHTTPServer.SimpleHTTPRequestHandler): |