Fix CI environment variable passing; write CI vars to /etc/environment
This commit is contained in:
parent
b4b738abe5
commit
7df2303dea
4 changed files with 14 additions and 9 deletions
3
Makefile
3
Makefile
|
|
@ -16,7 +16,6 @@ qemu_disk = tmp/qemu-disk.img
|
|||
qemu_target ?= debian-stretch
|
||||
qemu_kernel = $(qemu_target).linux
|
||||
qemu_torrent = $(qemu_target).torrent
|
||||
|
||||
qemu_initramfs = $(shell \
|
||||
if [ -e $(qemu_target).initramfs.dev ] && [ `date -r $(qemu_target).initramfs.dev +%s` -gt `date -r $(qemu_target).initramfs +%s` ]; then \
|
||||
echo "$(qemu_target).initramfs.dev"; \
|
||||
|
|
@ -24,6 +23,7 @@ else \
|
|||
echo "$(qemu_target).initramfs"; \
|
||||
fi \
|
||||
)
|
||||
ci_environment=$(shell env | sed -n 's/^\(CI_.*\)=.*/-e \1/p')
|
||||
|
||||
.PHONY: default
|
||||
default: dockerimg images/debian-stretch.squashfs
|
||||
|
|
@ -51,6 +51,7 @@ images/debian-stretch.squashfs: images
|
|||
-e "group=`id -g`" \
|
||||
-e "ANNOUNCE=$(ANNOUNCE)" \
|
||||
-e "WEBSEED=$(WEBSEED)" \
|
||||
$(ci_environment) \
|
||||
"$(DOCKER_IMAGE)" \
|
||||
debian-stretch
|
||||
|
||||
|
|
|
|||
3
packer/ansible/inventories/qemu
Normal file
3
packer/ansible/inventories/qemu
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
[default]
|
||||
qemumachine ansible_host=10.2.2.10
|
||||
spielkiste ansible_host=10.105.255.154
|
||||
|
|
@ -7,7 +7,7 @@
|
|||
"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_project_url": "{{env `CI_PROJECT_URL`}}",
|
||||
"ci_pipeline_triggered": "{{env `PIPELINE_TRIGGERED`}}",
|
||||
"ci_job_manual": "{{env `CI_JOB_MANUAL`}}"
|
||||
},
|
||||
|
|
@ -32,7 +32,13 @@
|
|||
{
|
||||
"type": "shell",
|
||||
"inline": [
|
||||
"sed -i 's/@@CI_REPOSITORY_URL@@/{{user `ci_repository_url`}}/' /etc/initramfs-tools/scripts/labsync"
|
||||
"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"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
|
@ -44,11 +50,6 @@
|
|||
"type": "shell",
|
||||
"inline": [
|
||||
"set -x",
|
||||
"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 dist-upgrade",
|
||||
"rmdir /boot && ln -s /usr/local/boot /boot",
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ Starting
|
|||
"mm "mm"# ##m#" "mmm" "# # # "#mm"
|
||||
m"
|
||||
""
|
||||
@@CI_REPOSITORY_URL@@
|
||||
@@PROJECT_URL@@
|
||||
|
||||
EOM
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue