# 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.

# Terraform version used is 1.3.0.
substitutions:
  _CFT_TOOLS_CONTAINER: "gcr.io/cloud-foundation-cicd/cft/developer-tools-light@sha256:2d4d0f72d0dec6b388c8d8dc6d5eaf1fb23b4a24a1184a377fdf56ada630902d"

options:
  env: ["GOPATH=/go"]
  machineType: "N1_HIGHCPU_8"

steps:
- name: "gcr.io/cloud-builders/go"
  entrypoint: "sh"
  args: ["build/license_check.sh"]
  waitFor: ["-"]
  id: License headers check

- name: "gcr.io/cloud-builders/npm:current"
  entrypoint: "sh"
  args: ["build/md_check.sh"]
  waitFor: ["-"]
  id: Markdownlint check

- name: "${_CFT_TOOLS_CONTAINER}"
  entrypoint: "terraform"
  args: ["version"]
  waitFor: ["-"]
  id: Terraform version

- name: "${_CFT_TOOLS_CONTAINER}"
  entrypoint: "sh"
  args: ["build/go_check.sh"]
  waitFor: ["-"]
  id: Go code check

- name: "${_CFT_TOOLS_CONTAINER}"
  entrypoint: "bash"
  args: ["build/sh_syntax_check.sh"]
  waitFor: ["-"]
  id: Bash scripts syntax check

- name: "${_CFT_TOOLS_CONTAINER}"
  entrypoint: "bash"
  args: ["build/gen_check.sh"]
  waitFor: ["-"]
  id: Generated files check
