From 4e5201a9899dba6896bddd52a5c526373b45a168 Mon Sep 17 00:00:00 2001 From: Silvija Tovernic Date: Thu, 19 Sep 2024 17:48:51 +0200 Subject: [PATCH] add: test jinja action packer --- .github/workflows/packer-build-if-vm.yml | 32 +++++++++++++++++++ .../azure.pkr.hcl | 0 .../build.pkr.hcl | 0 .../plugins.pkr.hcl | 0 .../values.auto.pkrvars.hcl | 0 .../values.auto.pkrvars.hcl.j2 | 3 ++ .../variables.pkr.hcl | 0 7 files changed, 35 insertions(+) create mode 100644 .github/workflows/packer-build-if-vm.yml rename images/packer/{image-factory-host-vm => image-factory-vm}/azure.pkr.hcl (100%) rename images/packer/{image-factory-host-vm => image-factory-vm}/build.pkr.hcl (100%) rename images/packer/{image-factory-host-vm => image-factory-vm}/plugins.pkr.hcl (100%) rename images/packer/{image-factory-host-vm => image-factory-vm}/values.auto.pkrvars.hcl (100%) create mode 100644 images/packer/image-factory-vm/values.auto.pkrvars.hcl.j2 rename images/packer/{image-factory-host-vm => image-factory-vm}/variables.pkr.hcl (100%) diff --git a/.github/workflows/packer-build-if-vm.yml b/.github/workflows/packer-build-if-vm.yml new file mode 100644 index 00000000..7ea9f1da --- /dev/null +++ b/.github/workflows/packer-build-if-vm.yml @@ -0,0 +1,32 @@ +name: Build Image Factory VM + +on: + push: + paths: + - ".github/workflows/packer-build-if-runner-host-vm.yml" + - "images/packer/image-factory-vm" + workflow_dispatch: + +jobs: + packer-build: + runs-on: ubuntu-latest + + env: + IMAGE_NAME: "image-factory-runner" + IMAGE_TAG: "${{ github.run_number }}" + IMAGE_FOLDER: "images/docker/image-factory-runner" + REGISTRY: ${{ secrets.REGISTRY }} + + steps: + - name: Checkout Repository + uses: actions/checkout@v4 + + - name: Test jinja action + uses: cuchi/jinja2-action@v1.2.2 + with: + template: images/packer/image-factory-vm/values.auto.pkrvars.hcl.j2 + output_file: images/packer/image-factory-vm/test.auto.pkrvars.hcl + variables: | + location="test" + resource_group="$IMAGE_NAME" + gallery_name="test" \ No newline at end of file diff --git a/images/packer/image-factory-host-vm/azure.pkr.hcl b/images/packer/image-factory-vm/azure.pkr.hcl similarity index 100% rename from images/packer/image-factory-host-vm/azure.pkr.hcl rename to images/packer/image-factory-vm/azure.pkr.hcl diff --git a/images/packer/image-factory-host-vm/build.pkr.hcl b/images/packer/image-factory-vm/build.pkr.hcl similarity index 100% rename from images/packer/image-factory-host-vm/build.pkr.hcl rename to images/packer/image-factory-vm/build.pkr.hcl diff --git a/images/packer/image-factory-host-vm/plugins.pkr.hcl b/images/packer/image-factory-vm/plugins.pkr.hcl similarity index 100% rename from images/packer/image-factory-host-vm/plugins.pkr.hcl rename to images/packer/image-factory-vm/plugins.pkr.hcl diff --git a/images/packer/image-factory-host-vm/values.auto.pkrvars.hcl b/images/packer/image-factory-vm/values.auto.pkrvars.hcl similarity index 100% rename from images/packer/image-factory-host-vm/values.auto.pkrvars.hcl rename to images/packer/image-factory-vm/values.auto.pkrvars.hcl diff --git a/images/packer/image-factory-vm/values.auto.pkrvars.hcl.j2 b/images/packer/image-factory-vm/values.auto.pkrvars.hcl.j2 new file mode 100644 index 00000000..be55155c --- /dev/null +++ b/images/packer/image-factory-vm/values.auto.pkrvars.hcl.j2 @@ -0,0 +1,3 @@ +location = "{{ location }}" +resource_group = "{{ resource_group }}" +gallery_name = "{{ gallery_name }}" diff --git a/images/packer/image-factory-host-vm/variables.pkr.hcl b/images/packer/image-factory-vm/variables.pkr.hcl similarity index 100% rename from images/packer/image-factory-host-vm/variables.pkr.hcl rename to images/packer/image-factory-vm/variables.pkr.hcl