labsync/packer.json
2018-02-17 20:34:23 +01:00

40 lines
1.3 KiB
JSON

{
"variables": {
"ci_job_id": "{{env `CI_JOB_ID`}}",
"ci_commit_sha": "{{env `CI_COMMIT_SHA`}}",
"ci_commit_tag": "{{env `CI_COMMIT_TAG`}}",
"ci_commit_ref_name": "{{env `CI_COMMIT_REF_NAME`}}",
"ci_commit_ref_slug": "{{env `CI_COMMIT_REF_SLUG`}}",
"ci_job_name": "{{env `CI_JOB_NAME`}}",
"ci_job_stage": "{{env `CI_JOB_STAGE`}}",
"ci_repository_url": "{{env `CI_REPOSITORY_URL`}}",
"ci_pipeline_triggered": "{{env `PIPELINE_TRIGGERED`}}",
"ci_job_manual": "{{env `CI_JOB_MANUAL`}}"
},
"builders":
[
{
"type": "docker",
"image": "debian:stretch",
"export_path": "build/rootfs.tar"
}
],
"provisioners": [
{
"type": "shell",
"inline": [
"echo \"job: {{user `ci_job_id`}}\" > /.build-info",
"echo \"commit: {{user `ci_commit_sha`}}\" >> /.build-info",
"echo \"commit tag: {{user `ci_commit_tag`}}\" >> /.build-info",
"echo \"commit ref name: {{user `ci_commit_ref_name`}}\" >> /.build-info",
"echo \"commit ref slug: {{user `ci_commit_ref_slug`}}\" >> /.build-info",
"apt-get update && apt-get -y install python openssh-server"
]
},
{
"type": "ansible",
"playbook_file": "ansible/playbook.yml",
"user": "root"
}
]
}