# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

steps:
- name: python:3.8.4-slim
  args:
  - /bin/sh
  - -c
  - |
    set -e

    packer_version=1.6.0
    packer_archive=packer_${packer_version}_linux_amd64.zip

    apt update
    apt install -y --no-install-recommends \
      curl \
      unzip

    curl -LO https://releases.hashicorp.com/packer/${packer_version}/${packer_archive}
    unzip ${packer_archive}

    ./packer build \
      -var project-id=${PROJECT_ID} \
      -var subnetwork=app2 \
      -var image-version=v5 \
      -var awx-version=13.0.0 \
      build.json
