diff --git a/.gitlab-ci/b2c/b2c.yml.jinja2.jinja2 b/.gitlab-ci/b2c/b2c.yml.jinja2.jinja2 index e6c4595c53c..6c5d6a51864 100644 --- a/.gitlab-ci/b2c/b2c.yml.jinja2.jinja2 +++ b/.gitlab-ci/b2c/b2c.yml.jinja2.jinja2 @@ -7,62 +7,62 @@ target: timeouts: first_console_activity: # This limits the time it can take to receive the first console log - minutes: {{ timeout_first_console_activity_minutes | default(0, true) }} - seconds: {{ timeout_first_console_activity_seconds | default(0, true) }} - retries: {{ timeout_first_console_activity_retries }} + minutes: {{ B2C_TIMEOUT_FIRST_CONSOLE_ACTIVITY_MINUTES | default(0, true) }} + seconds: {{ B2C_TIMEOUT_FIRST_CONSOLE_ACTIVITY_SECONDS | default(0, true) }} + retries: {{ B2C_TIMEOUT_FIRST_CONSOLE_ACTIVITY_RETRIES }} console_activity: # Reset every time we receive a message from the logs - minutes: {{ timeout_console_activity_minutes | default(0, true) }} - seconds: {{ timeout_console_activity_seconds | default(0, true) }} - retries: {{ timeout_console_activity_retries }} + minutes: {{ B2C_TIMEOUT_CONSOLE_ACTIVITY_MINUTES | default(0, true) }} + seconds: {{ B2C_TIMEOUT_CONSOLE_ACTIVITY_SECONDS | default(0, true) }} + retries: {{ B2C_TIMEOUT_CONSOLE_ACTIVITY_RETRIES }} boot_cycle: - minutes: {{ timeout_boot_minutes | default(0, true) }} - seconds: {{ timeout_boot_seconds | default(0, true) }} - retries: {{ timeout_boot_retries }} + minutes: {{ B2C_TIMEOUT_BOOT_MINUTES | default(0, true) }} + seconds: {{ B2C_TIMEOUT_BOOT_SECONDS | default(0, true) }} + retries: {{ B2C_TIMEOUT_BOOT_RETRIES }} overall: # Maximum time the job can take, not overrideable by the "continue" deployment - minutes: {{ timeout_overall_minutes | default(0, true) }} - seconds: {{ timeout_overall_seconds | default(0, true) }} + minutes: {{ B2C_TIMEOUT_OVERALL_MINUTES | default(0, true) }} + seconds: {{ B2C_TIMEOUT_OVERALL_SECONDS | default(0, true) }} retries: 0 # no retries possible here watchdogs: boot: - minutes: {{ timeout_boot_wd_minutes | default(0, true) }} - seconds: {{ timeout_boot_wd_seconds | default(0, true) }} - retries: {{ timeout_boot_wd_retries | default(0, true) }} + minutes: {{ B2C_TIMEOUT_BOOT_WD_MINUTES | default(0, true) }} + seconds: {{ B2C_TIMEOUT_BOOT_WD_SECONDS | default(0, true) }} + retries: {{ B2C_TIMEOUT_BOOT_WD_RETRIES | default(0, true) }} console_patterns: session_end: regex: >- - {{ session_end_regex }} -{% if session_reboot_regex %} + {{ B2C_SESSION_END_REGEX }} +{% if SESSIONB2C__REBOOT_REGEX %} session_reboot: regex: >- - {{ session_reboot_regex }} + {{ B2C_SESSION_REBOOT_REGEX }} {% endif %} job_success: regex: >- - {{ job_success_regex }} -{% if job_warn_regex %} + {{ B2C_JOB_SUCCESS_REGEX }} +{% if JOB_WARB2C_N_REGEX %} job_warn: regex: >- - {{ job_warn_regex }} + {{ B2C_JOB_WARN_REGEX }} {% endif %} -{% if boot_wd_start_regex and boot_wd_stop_regex %} +{% if B2C_BOOT_WD_START_REGEX and B2C_BOOT_WD_STOP_REGEX %} watchdogs: boot: start: regex: >- - {{ boot_wd_start_regex }} + {{ B2C_BOOT_WD_START_REGEX }} reset: regex: >- - {{ boot_wd_reset_regex | default(boot_wd_start_regex, true) }} + {{ B2C_BOOT_WD_RESET_REGEX | default(B2C_BOOT_WD_START_REGEX, true) }} stop: regex: >- - {{ boot_wd_stop_regex }} + {{ B2C_BOOT_WD_STOP_REGEX }} {% endif %} # Environment to deploy @@ -70,24 +70,24 @@ deployment: # Initial boot start: storage: -{% if imagestore_platform %} +{% if B2C_IMAGESTORE_PLATFORM %} imagestore: public: # List of images that should be pulled into the image store ahead of execution images: mars: - name: "{{ machine_registration_image }}" - platform: "{{ imagestore_platform }}" + name: "{{ B2C_MACHINE_REGISTRATION_IMAGE }}" + platform: "{{ B2C_IMAGESTORE_PLATFORM }}" tls_verify: false {% set machine_registration_image="{% raw %}{{ job.imagestore.public.mars.image_id }}{% endraw %}" %} telegraf: - name: "{{ telegraf_image }}" - platform: "{{ imagestore_platform }}" + name: "{{ B2C_TELEGRAF_IMAGE }}" + platform: "{{ B2C_IMAGESTORE_PLATFORM }}" tls_verify: false {% set telegraf_image="{% raw %}{{ job.imagestore.public.telegraf.image_id }}{% endraw %}" %} image_under_test: - name: "{{ image_under_test }}" - platform: "{{ imagestore_platform }}" + name: "{{ B2C_IMAGE_UNDER_TEST }}" + platform: "{{ B2C_IMAGESTORE_PLATFORM }}" tls_verify: false {% set image_under_test="{% raw %}{{ job.imagestore.public.image_under_test.image_id }}{% endraw %}" %} nbd: @@ -98,21 +98,21 @@ deployment: http: - path: "/install.tar.zst" - url: "{{ install_tarball_url }}" + url: "{{ B2C_INSTALL_TARBALL_URL }}" - path: "/b2c-extra-args" data: > - b2c.pipefail b2c.poweroff_delay={{ poweroff_delay }} + b2c.pipefail b2c.poweroff_delay={{ B2C_POWEROFF_DELAY }} b2c.minio="gateway,{{ '{{' }} minio_url }},{{ '{{' }} job_bucket_access_key }},{{ '{{' }} job_bucket_secret_key }}" - b2c.volume="{{ '{{' }} job_bucket }}-results,mirror=gateway/{{ '{{' }} job_bucket }},pull_on=pipeline_start,push_on=changes,overwrite{% for excl in job_volume_exclusions.split(',') %},exclude={{ excl }}{% endfor %},remove,expiration=pipeline_end,preserve" - {% for volume in volumes %} + b2c.volume="{{ '{{' }} job_bucket }}-results,mirror=gateway/{{ '{{' }} job_bucket }},pull_on=pipeline_start,push_on=changes,overwrite{% for excl in B2C_JOB_VOLUME_EXCLUSIONS.split(',') %},exclude={{ excl }}{% endfor %},remove,expiration=pipeline_end,preserve" + {% for volume in B2C_VOLUMES %} b2c.volume={{ volume }} {% endfor %} - b2c.run_service="--privileged --tls-verify=false --pid=host {{ telegraf_image }}" b2c.hostname=dut-{{ '{{' }} machine.full_name }} - b2c.run="-ti --tls-verify=false {{ machine_registration_image }} {% if mars_setup_tags %}setup --tags {{ mars_setup_tags }}{% else %}check{% endif %}" - b2c.run="-v {{ '{{' }} job_bucket }}-results:{{ working_dir }} -w {{ working_dir }} {% for mount_volume in mount_volumes %} -v {{ mount_volume }}{% endfor %} --tls-verify=false --entrypoint bash {{image_under_test}} -euc 'curl -q {{ '{{' }} job.http.url }}/install.tar.zst | tar --zstd -x; {{ container_cmd }}'" + b2c.run_service="--privileged --tls-verify=false --pid=host {{ B2C_TELEGRAF_IMAGE }}" b2c.hostname=dut-{{ '{{' }} machine.full_name }} + b2c.run="-ti --tls-verify=false {{ B2C_MACHINE_REGISTRATION_IMAGE }} {% if B2C_MARS_SETUP_TAGS %}setup --tags {{ B2C_MARS_SETUP_TAGS }}{% else %}check{% endif %}" + b2c.run="-v {{ '{{' }} job_bucket }}-results:{{ working_dir }} -w {{ working_dir }} {% for mount_volume in B2C_MOUNT_VOLUMES %} -v {{ mount_volume }}{% endfor %} --tls-verify=false --entrypoint bash {{ B2C_IMAGE_UNDER_TEST }} -euc 'curl -q {{ '{{' }} job.http.url }}/install.tar.zst | tar --zstd -x; {{ B2C_CONTAINER_CMD }}'" kernel: -{% if kernel_url %} - url: '{{ kernel_url }}' +{% if B2C_KERNEL_URL %} + url: '{{ B2C_KERNEL_URL }}' {% endif %} # NOTE: b2c.cache_device should not be here, but this works around @@ -122,7 +122,7 @@ deployment: console={{ '{{' }} local_tty_device }},115200 b2c.ntp_peer=10.42.0.1 b2c.extra_args_url={{ '{{' }} job.http.url }}/b2c-extra-args - {% if imagestore_platform is defined %} + {% if B2C_IMAGESTORE_PLATFORM is defined %} {{ '{{' }} imagestore.mount("public").nfs.to_b2c_filesystem("publicimgstore") }} b2c.storage="additionalimagestores=publicimgstore" b2c.nbd=/dev/nbd0,host=ci-gateway,port={% raw %}{{ '{{' }} job.nbd.storage.tcp_port }}{% endraw %},connections=5 @@ -130,26 +130,26 @@ deployment: {% else %} b2c.cache_device=auto {% endif %} - {% if kernel_cmdline_extras is defined %} - {{ kernel_cmdline_extras }} + {% if B2C_KERNEL_CMDLINE_EXTRAS is defined %} + {{ B2C_KERNEL_CMDLINE_EXTRAS }} {% endif %} -{% if initramfs_url or firmware_url %} +{% if B2C_INITRAMFS_URL or B2C_FIRMWARE_URL %} initramfs: -{% if firmware_url %} - - url: '{{ firmware_url }}' +{% if B2C_FIRMWARE_URL %} + - url: '{{ B2C_FIRMWARE_URL }}' {% endif %} -{% if initramfs_url %} - - url: '{{ initramfs_url }}' +{% if B2C_INITRAMFS_URL %} + - url: '{{ B2C_INITRAMFS_URL }}' {% endif %} {% endif %} -{% if dtb_url %} +{% if B2C_DTB_URL %} dtb: - url: '{{ dtb_url }}' -{% if dtb_match %} + url: '{{ B2C_DTB_URL }}' +{% if B2C_DTB_MATCH %} format: archive: - match: "{{ dtb_match }}" + match: "{{ B2C_DTB_MATCH }}" {% endif %} {% endif %} diff --git a/.gitlab-ci/b2c/generate_b2c.py b/.gitlab-ci/b2c/generate_b2c.py index 07e053727dd..699d5705d33 100755 --- a/.gitlab-ci/b2c/generate_b2c.py +++ b/.gitlab-ci/b2c/generate_b2c.py @@ -25,9 +25,9 @@ from jinja2 import Environment, FileSystemLoader from os import environ, path -# Pass all the environment variables prefixed by B2C_ +# Pass through all the B2C environment variables values = { - key.removeprefix("B2C_").lower(): environ[key] + key: environ[key] for key in environ if key.startswith("B2C_") } @@ -40,12 +40,8 @@ values['ci_job_id'] = environ['CI_JOB_ID'] values['ci_runner_description'] = environ['CI_RUNNER_DESCRIPTION'] values['working_dir'] = environ['CI_PROJECT_DIR'] -values['image_under_test'] = environ['B2C_IMAGE_UNDER_TEST'] -values['machine_registration_image'] = environ['B2C_MACHINE_REGISTRATION_IMAGE'] -values['telegraf_image'] = environ['B2C_TELEGRAF_IMAGE'] - # Pull all our images through our proxy registry -for image in ['image_under_test', 'machine_registration_image', 'telegraf_image']: +for image in ['B2C_IMAGE_UNDER_TEST', 'B2C_MACHINE_REGISTRATION_IMAGE', 'B2C_TELEGRAF_IMAGE']: values[image] = values[image].replace( 'registry.freedesktop.org', '{{ fdo_proxy_registry }}'