{
  "variables": {
    "pipeline_prefix": "local-testing-",
    "hashed_pipeline_prefix": "0b7ad56c-671b-5244-9f36-01f92928abf8",
    "geode_docker_image": "unset",
    "gcp_project": "unset",
    "java_build_version": "8",
    "packer_ttl": ""
  },
  "builders": [
    {
      "type": "googlecompute",
      "project_id": "{{user `gcp_project`}}",
      "source_image": "{{ user `base_image`}}",
      "ssh_username": "packer",
      "zone": "us-central1-f",
      "image_family": "{{user `pipeline_prefix`}}linux-geode-builder",
      "image_name": "{{user `hashed_pipeline_prefix`}}gb-{{timestamp}}",
      "tags": ["packer"],
      "labels": {
        "time-to-live": "{{user `packer_ttl`}}",
        "instance_type": "packer"
      }
    }
  ],
  "provisioners": [
    {
      "type": "shell",
      "inline": ["mkdir -p /tmp/work"]
    },
    {
      "type": "shell",
      "environment_vars": [
        "GEODE_DOCKER_IMAGE={{user `geode_docker_image`}}"
      ],
      "execute_command": "sudo -S sh -c '{{ .Vars }} {{ .Path }}'",
      "script": "scripts/setup.sh"
    },
    {
      "type": "shell",
      "environment_vars": [
        "JAVA_BUILD_VERSION={{user `java_build_version`}}"
      ],
      "execute_command": "sudo -u geode -S sh -c '{{ .Vars }} {{ .Path }}'",
      "script": "scripts/cache_dependencies.sh"
    }
  ]
}
