# Copyright 2023-2024 Broadcom. All rights reserved. # SPDX-License-Identifier: BSD-2 ############################################################################## ## ## Auto-generated .gitlab-ci.yml for building Packer Example for vSphere ## ## Do not modify this file directly, either: ## ## - Modify the source build-ci.yaml. ## - Modify the template build-ci.tmpl. ## ## then run the following command to re-create the .gitlab-ci.yml file: ## ## gomplate -c build-ci.yaml -f build-ci.tmpl -o .gitlab-ci.yml ## ############################################################################## variables: SCRIPT_PATH: "${CI_PROJECT_DIR}" CONFIG_PATH: "${CI_PROJECT_DIR}/config" INPUT_PATH: "" BUILD_VARS: "" EXTRA_VAR_FILES: "" BUILD_ONLY: "" ############################################################################## .packer-build: stage: build #tags: # - packer before_script: - "packer init \"$INPUT_PATH\"" - "packer validate -var-file=\"$CONFIG_PATH/vsphere.pkrvars.hcl\" -var-file=\"$CONFIG_PATH/build.pkrvars.hcl\" -var-file=\"$CONFIG_PATH/ansible.pkrvars.hcl\" -var-file=\"$CONFIG_PATH/proxy.pkrvars.hcl\" -var-file=\"$CONFIG_PATH/common.pkrvars.hcl\" -var-file=\"$CONFIG_PATH/$BUILD_VARS\" ${EXTRA_VAR_FILES} \"$INPUT_PATH\"" script: - "packer build -force -on-error=ask -var-file=\"$CONFIG_PATH/vsphere.pkrvars.hcl\" -var-file=\"$CONFIG_PATH/build.pkrvars.hcl\" -var-file=\"$CONFIG_PATH/ansible.pkrvars.hcl\" -var-file=\"$CONFIG_PATH/proxy.pkrvars.hcl\" -var-file=\"$CONFIG_PATH/common.pkrvars.hcl\" -var-file=\"$CONFIG_PATH/$BUILD_VARS\" ${EXTRA_VAR_FILES} ${BUILD_ONLY} \"$INPUT_PATH\"" when: manual ############################################################################## {{ range $menu := (ds "build-ci").menu -}} {{ range $submenu := $menu.submenu -}} {{ $submenu.entry | strings.ReplaceAll " (cloud-init)" "" | strings.ReplaceAll " " "-" | strings.ReplaceAll "---" "-" }}: extends: .packer-build variables: INPUT_PATH: "$SCRIPT_PATH/{{ $submenu.build.path }}" BUILD_VARS: "{{ $submenu.build.path | strings.ReplaceAll "builds" "" | strings.TrimPrefix "/" | strings.TrimSuffix "/" | strings.ReplaceAll "/" "-" }}.pkrvars.hcl" {{- if (coll.Has $submenu.build "only") }} BUILD_ONLY: "--only {{ join $submenu.build.only "," }}" {{- end -}} {{- if (coll.Has $submenu.build "var_files") }} EXTRA_VAR_FILES: "{{ range $index, $value := $submenu.build.var_files }}{{if $index}} {{end}}-var-file=$CONFIG_PATH/{{ $value }}{{ end }}" {{- end }} ############################################################################## {{ end }}{{ end -}}