forked from GoogleCloudPlatform/jenkins-gcp-leader
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpacker.json
71 lines (71 loc) · 2.21 KB
/
packer.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
{
"variables": {
"name": "jenkins-gcp-leader",
"git_commit": "",
"git_branch": "",
"account_file": "",
"project_id": "null"
},
"builders": [
{
"type": "docker",
"image": "jenkins:1.625.3",
"run_command": ["-d", "-i", "-t", "-u", "root", "{{.Image}}", "/bin/bash"],
"commit": "true"
}
],
"provisioners": [
{
"type": "file",
"source": "plugins.txt",
"destination": "/usr/share/jenkins/plugins.txt"
},
{
"type": "file",
"source": "workflow-version.txt",
"destination": "/usr/share/jenkins/workflow-version.txt"
},
{
"type": "file",
"source": "jenkins/jobs",
"destination": "/usr/share/jenkins/ref"
},
{
"type": "file",
"source": "start.sh",
"destination": "/usr/local/bin/start.sh"
},
{
"type": "shell",
"environment_vars" : [ "CLOUDSDK_CORE_DISABLE_PROMPTS=1" ],
"inline": [
"chmod +x /usr/local/bin/start.sh",
"sed -i \"s/@VERSION@/`cat /usr/share/jenkins/workflow-version.txt`/g\" /usr/share/jenkins/plugins.txt",
"/usr/local/bin/plugins.sh /usr/share/jenkins/plugins.txt",
"apt-get update -y",
"apt-get upgrade -y",
"apt-get install -y -qq --no-install-recommends wget unzip python openssh-client rsync",
"apt-get clean",
"cd /usr/local/bin",
"wget https://dl.google.com/dl/cloudsdk/release/google-cloud-sdk.zip",
"unzip google-cloud-sdk.zip",
"rm google-cloud-sdk.zip",
"google-cloud-sdk/install.sh --usage-reporting=true --disable-installation-options",
"google-cloud-sdk/bin/gcloud --quiet components update preview",
"google-cloud-sdk/bin/gcloud --quiet config set component_manager/disable_update_check true",
"ln -s /usr/local/bin/google-cloud-sdk/bin/gcloud /usr/local/bin/gcloud",
"ln -s /usr/local/bin/google-cloud-sdk/bin/gsutil /usr/local/bin/gsutil"
]
}
],
"post-processors": [
[
{
"type": "docker-tag",
"repository": "gcr.io/{{user `project_id`}}/{{user `name`}}",
"tag": "{{user `git_branch`}}-{{user `git_commit`}}",
"only": ["docker"]
}
]
]
}