81 lines
2.7 KiB
JSON
81 lines
2.7 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_project_url": "{{env `CI_PROJECT_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": [ "mkdir -p /etc/initramfs-tools/scripts/local-premount/" ]
|
|
},
|
|
{
|
|
"type": "file",
|
|
"source": "initramfs/labsync",
|
|
"destination": "/etc/initramfs-tools/scripts/"
|
|
},
|
|
{
|
|
"type": "shell",
|
|
"inline": [
|
|
"echo \"LABSYNC_JOB_ID='{{user `ci_job_id`}}'\" >> /etc/environment",
|
|
"echo \"LABSYNC_COMMIT_SHA='{{user `ci_commit_sha`}}'\" >> /etc/environment",
|
|
"echo \"LABSYNC_COMMIT_TAG='{{user `ci_commit_tag`}}'\" >> /etc/environment",
|
|
"echo \"LABSYNC_COMMIT_REF_NAME='{{user `ci_commit_ref_name`}}'\" >> /etc/environment",
|
|
"echo \"LABSYNC_COMMIT_REF_SLUG='{{user `ci_commit_ref_slug`}}'\" >> /etc/environment",
|
|
"echo \"LABSYNC_PROJECT_URL='{{user `ci_project_url`}}'\" >> /etc/environment",
|
|
"sed -i 's#@@PROJECT_URL@@#{{user `ci_project_url`}}#' /etc/initramfs-tools/scripts/labsync"
|
|
]
|
|
},
|
|
{
|
|
"type": "file",
|
|
"source": "initramfs/labsync-prereqs",
|
|
"destination": "/etc/initramfs-tools/scripts/local-premount/"
|
|
},
|
|
{
|
|
"type": "shell",
|
|
"inline": [
|
|
"set -x",
|
|
"apt-get update",
|
|
"apt-get -y dist-upgrade",
|
|
"rmdir /boot && ln -s /usr/local/boot /boot",
|
|
"apt-get -y install initramfs-tools || true",
|
|
"echo squashfs >> /etc/initramfs-tools/modules",
|
|
"echo overlay >> /etc/initramfs-tools/modules",
|
|
"echo 'RESUME=none' > /etc/initramfs-tools/conf.d/resume",
|
|
"mkdir /usr/local/boot",
|
|
"apt-get -f -y install aria2 linux-image-amd64 lvm2",
|
|
"mkdir /artifacts",
|
|
"cp $(find /boot/ -name 'initrd.img-*' | sort -V | tail -n 1) /artifacts/initramfs",
|
|
"cp $(find /boot/ -name 'vmlinuz-*' | sort -V | tail -n 1) /artifacts/linux"
|
|
]
|
|
},
|
|
{
|
|
"type": "shell",
|
|
"inline": [ "apt-get -y install openssh-server python" ]
|
|
},
|
|
{
|
|
"type": "ansible",
|
|
"playbook_file": "ansible/playbook.yml",
|
|
"user": "root"
|
|
},
|
|
{
|
|
"type": "shell",
|
|
"inline": [ "rm /boot && mkdir /boot" ]
|
|
}
|
|
]
|
|
}
|