Skip to content

Commit

Permalink
Merge branch 'master' of github.com:GoogleCloudPlatform/cloud-foundat…
Browse files Browse the repository at this point in the history
…ion-toolkit into up-13-cft
  • Loading branch information
arbrown committed Sep 20, 2023
2 parents 0fc2ab8 + 52db8b3 commit 448ba9c
Show file tree
Hide file tree
Showing 113 changed files with 1,612 additions and 2,397 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/issue-template.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ assignees: ''

############################ NOTE #######################

Dear CFT User!
Dear CFT User!

If you are looking to build new GCP infrastructure, we recommend that you use [Terraform CFT modules](https://g.co/dev/terraformfoundation)
Terraform CFT supports the most recent GCP resources, reflects GCP best practices can be used off-the-shelf to quickly build a repeatable enterprise-ready foundation.
Expand Down
10 changes: 10 additions & 0 deletions .github/renovate.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"separateMajorMinor": false,
"ignorePaths": ["config-connector/**"],
"additionalBranchPrefix": "{{parentDir}}-",
"constraints": {"go": "1.20"},
"packageRules": [
{
"matchFileNames": [".github/**"],
Expand Down Expand Up @@ -55,6 +56,15 @@
"datasourceTemplate": "docker",
"registryUrlTemplate": "https://gcr.io/cloud-foundation-cicd",
"depNameTemplate": "cft/developer-tools"
},
{
"fileMatch": ["(^|/)build/(int|lint)\\.cloudbuild\\.yaml$"],
"matchStrings": [
" _DOCKER_TAG_VERSION_DEVELOPER_TOOLS: '(?<currentValue>.*?)'\\n"
],
"datasourceTemplate": "docker",
"registryUrlTemplate": "https://gcr.io/cloud-foundation-cicd",
"depNameTemplate": "cft/developer-tools"
}
]
}
2 changes: 1 addition & 1 deletion .github/workflows/build-push-cft-devtools.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
id-token: 'write'

steps:
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4

- id: 'auth'
name: 'Authenticate to Google Cloud'
Expand Down
86 changes: 86 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
paths:
- '**/*.go'
- '**/*.js'
- '**/*.py'
- '**/*.rb'
schedule:
- cron: '32 11 * * 0'

jobs:
analyze:
name: Analyze
# Runner size impacts CodeQL analysis time. To learn more, please see:
# - https://gh.io/recommended-hardware-resources-for-running-codeql
# - https://gh.io/supported-runners-and-hardware-resources
# - https://gh.io/using-larger-runners
# Consider using larger runners for possible analysis time improvements.
runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
timeout-minutes: ${{ (matrix.language == 'swift' && 120) || 360 }}
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: [ 'go', 'javascript', 'python', 'ruby' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby', 'swift' ]
# Use only 'java' to analyze code written in Java, Kotlin or both
# Use only 'javascript' to analyze code written in JavaScript, TypeScript or both
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support

steps:
- name: Checkout repository
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@6a28655e3dcb49cb0840ea372fd6d17733edd8a4 # v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.

# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality


# Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@6a28655e3dcb49cb0840ea372fd6d17733edd8a4 # v2

# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun

# If the Autobuild fails above, remove it and uncomment the following three lines.
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.

# - run: |
# echo "Run, Build Application using script"
# ./location_of_script_within_repo/buildscript.sh

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@6a28655e3dcb49cb0840ea372fd6d17733edd8a4 # v2
with:
category: "/language:${{matrix.language}}"
2 changes: 1 addition & 1 deletion .github/workflows/go-fbf-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
matrix:
operating-system: [ubuntu-latest, macos-latest]
steps:
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4
- uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4
with:
go-version-file: infra/utils/fbf/go.mod
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/go-lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
matrix:
folder: [cli, infra/blueprint-test]
steps:
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0
- uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0
with:
go-version-file: ${{ matrix.folder }}/go.mod
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/go-module-swapper.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
matrix:
operating-system: [ubuntu-latest, macos-latest]
steps:
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4
- uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4
with:
go-version-file: infra/module-swapper/go.mod
Expand All @@ -38,7 +38,7 @@ jobs:
strategy:
fail-fast: false
steps:
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0
- uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0
with:
go-version-file: infra/module-swapper/go.mod
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
name: 'lint-infra-terraform'
runs-on: 'ubuntu-latest'
steps:
- uses: 'actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744' # v3
- uses: 'actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac' # v4
- run: docker run --rm -e EXCLUDE_LINT_DIRS -e EXCLUDE_HEADER_CHECK -v ${{ github.workspace }}:/workspace gcr.io/cloud-foundation-cicd/cft/developer-tools:1 /usr/local/bin/test_lint.sh
env:
EXCLUDE_LINT_DIRS: '\./dm|\./config-connector|\./cli|\./infra/build|\./infra/utils|\./infra/blueprint-test|\./infra/concourse|\./infra/modules|\./reports|\./.github|\./docs|\./infra/module-swapper'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4
- uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 # v4
- uses: pre-commit/action@646c83fcd040023954eafda54b4db0192ce70507 # v3.0.0
8 changes: 4 additions & 4 deletions .github/workflows/release-cli.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Release new CLI versions
on:
push:
branches:
branches:
- "master"
paths:
- "cli/Makefile"
Expand All @@ -20,7 +20,7 @@ jobs:
id-token: 'write'

steps:
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4
- uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4
with:
go-version-file: cli/go.mod
Expand All @@ -38,7 +38,7 @@ jobs:
version: "410.0.0"

# used by make release which runs gcloud alpha storage
- name: Install gcloud alpha commands
- name: Install gcloud alpha commands
run: gcloud components install alpha

- name: Retrieve last released version
Expand All @@ -54,7 +54,7 @@ jobs:
chmod +x bin/*
- name: Archive build artifacts
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
with:
name: bin
path: cli/bin
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/scorecard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:

steps:
- name: "Checkout code"
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0
with:
persist-credentials: false

Expand All @@ -59,14 +59,14 @@ jobs:
# Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF
# format to the repository Actions tab.
- name: "Upload artifact"
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
with:
name: SARIF file
path: results.sarif
retention-days: 5

# Upload the results to GitHub's code scanning dashboard.
- name: "Upload to code-scanning"
uses: github/codeql-action/upload-sarif@a09933a12a80f87b87005513f0abb1494c27a716 # v2.21.4
uses: github/codeql-action/upload-sarif@6a28655e3dcb49cb0840ea372fd6d17733edd8a4 # v2.21.8
with:
sarif_file: results.sarif
2 changes: 1 addition & 1 deletion .github/workflows/test-cft-devtools.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4

- name: Build
run: |-
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/test-cli.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ jobs:
strategy:
fail-fast: false
matrix:
operating-system: [ubuntu-latest, macos-latest]
operating-system: [ubuntu-latest]
steps:
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4
- uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4
with:
go-version-file: cli/go.mod
cache-dependency-path: cli/go.sum
- run: |-
go test ./... -v
make test
21 changes: 17 additions & 4 deletions .github/workflows/update-tooling.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,34 @@ on:
schedule:
- cron: "0 2 * * *"
workflow_dispatch:
release:
types: [released]

env:
TERRAFORM_URL: "https://api.github.com/repos/hashicorp/terraform/releases/latest"
CLOUD_SDK_URL: "https://dl.google.com/dl/cloudsdk/channels/rapid/google-cloud-sdk.tar.gz"
KPT_URL: "https://api.github.com/repos/GoogleContainerTools/kpt/releases"
KPT_URL: "https://api.github.com/repos/kptdev/kpt/releases"
CFT_CLI_URL: "https://api.github.com/repos/GoogleCloudPlatform/cloud-foundation-toolkit/releases"
MODULE_SWAPPER_URL: "https://api.github.com/repos/GoogleCloudPlatform/cloud-foundation-toolkit/releases"
KUBECTL_MINOR: "1.26"
KUBECTL_URL: "https://api.github.com/repos/kubernetes/kubernetes/releases"
GATOR_MINOR: "3.13"
GATOR_URL: "https://api.github.com/repos/open-policy-agent/gatekeeper/releases"
GCRANE_URL: "https://api.github.com/repos/google/go-containerregistry/releases/latest"
KUSTOMIZE_URL: "https://api.github.com/repos/kubernetes-sigs/kustomize/releases"
TERRAGRUNT_URL: "https://api.github.com/repos/gruntwork-io/terragrunt/releases/latest"
TFLINT_URL: "https://api.github.com/repos/terraform-linters/tflint/releases/latest"

jobs:
update-tools:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0
- name: Update Tools
run: |
PR_UPDATE_BODY=""
newline=$'\n'
tools=("TERRAFORM" "CLOUD_SDK" "CFT_CLI" "KUBECTL" "GATOR" "GCRANE" "KPT")
tools=("TERRAFORM" "CLOUD_SDK" "CFT_CLI" "KUBECTL" "GATOR" "GCRANE" "KPT" "MODULE_SWAPPER" "KUSTOMIZE" "TERRAGRUNT" "TFLINT")
for tool in ${tools[@]}
do
Expand All @@ -41,12 +47,18 @@ jobs:
elif [ "$tool" == "CFT_CLI" ]; then
# get latest CFT_CLI release
LATEST_TOOL_VERSION=$(curl -s ${!TOOL_URL} | jq --raw-output '[ .[] | select( .name | contains("CLI Release"))][0].tag_name' | tr -d "cli/v")
elif [ "$tool" == "MODULE_SWAPPER" ]; then
# get latest MODULE_SWAPPER release
LATEST_TOOL_VERSION=$(curl -s ${!TOOL_URL} | jq --raw-output '[ .[] | select( .name | contains("infra/module-swapper"))][0].tag_name' | tr -d "infra/module\-swapper/v")
elif [ "$tool" == "KUBECTL" ]; then
# get latest KUBECTL_MINOR release
LATEST_TOOL_VERSION=$(curl -s ${!TOOL_URL} | jq --raw-output '[ .[] | select( .name | contains("'${KUBECTL_MINOR}'"))][0].tag_name' | tr -d "v")
LATEST_TOOL_VERSION=$(curl -s ${!TOOL_URL} | jq --raw-output '[ .[] | select( .name | contains("'${KUBECTL_MINOR}'"))][0].tag_name' | tr -d "v")
elif [ "$tool" == "GATOR" ]; then
# get latest GATOR_MINOR release
LATEST_TOOL_VERSION=$(curl -s ${!TOOL_URL} | jq --raw-output '[ .[] | select( .name | contains("'${GATOR_MINOR}'"))][0].tag_name' | tr -d "v")
elif [ "$tool" == "KUSTOMIZE" ]; then
# get latest KUSTOMIZE release
LATEST_TOOL_VERSION=$(curl -s ${!TOOL_URL} | jq --raw-output '[ .[] | select( .name | contains("kustomize"))][0].tag_name' | tr -d "kustomize/v")
else
LATEST_TOOL_VERSION=$(curl -s ${!TOOL_URL} | jq --raw-output .tag_name | tr -d "v")
fi
Expand Down Expand Up @@ -99,3 +111,4 @@ jobs:
labels: automated pr
reviewers: bharathkkb, apeabody
branch: create-pull-request/patch-tools-version
base: master
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ config-connector/tests/testcases/environments.yaml
.vscode
*.pyc
cli/bpmetadata/int-test/.working
go.work.sum
14 changes: 14 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
exclude: |
(?x)^(
config-connector/.*|
dm/.*|
reports/.*|
cli/testdata/.*|
cli/bptest/.*
)$
repos:
- repo: https://github.com/renovatebot/pre-commit-hooks
rev: 36.40.3
hooks:
- id: renovate-config-validator
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
4 changes: 2 additions & 2 deletions .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"infra/blueprint-test": "0.8.0",
"infra/module-swapper": "0.2.0"
"infra/blueprint-test": "0.8.1",
"infra/module-swapper": "0.2.1"
}
6 changes: 3 additions & 3 deletions cli/Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
SHELL := /bin/bash

# Changing this value will trigger a new release
VERSION=v1.2.4
VERSION=v1.2.6
BINARY=bin/cft
GITHUB_REPO=github.com/GoogleCloudPlatform/cloud-foundation-toolkit
PLATFORMS := linux windows darwin
Expand All @@ -12,7 +12,7 @@ INT_TEST_DIR=./bpmetadata/int-test
SCHEMA_DIR=./bpmetadata/schema
SRC_PROTO_DIR=./bpmetadata/proto
PROTOC_DIR=./bpmetadata
DOCKER_TAG_VERSION_DEVELOPER_TOOLS := 1.14
DOCKER_TAG_VERSION_DEVELOPER_TOOLS := 1.16
DOCKER_IMAGE_DEVELOPER_TOOLS := cft/developer-tools
REGISTRY_URL := gcr.io/cloud-foundation-cicd

Expand All @@ -25,7 +25,7 @@ build: protoc-gen build-schema

.PHONY: protoc-gen
protoc-gen:
docker run --rm -it \
docker run --rm \
-v "$(CURDIR)":/workspace \
$(REGISTRY_URL)/${DOCKER_IMAGE_DEVELOPER_TOOLS}:${DOCKER_TAG_VERSION_DEVELOPER_TOOLS} \
/bin/bash -c "protoc -I=${SRC_PROTO_DIR} --go_opt=paths=source_relative --go_out=${PROTOC_DIR} ${SRC_PROTO_DIR}/*.proto && \
Expand Down
2 changes: 1 addition & 1 deletion cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,4 @@ After build find binary at bin/cft location

## License

Apache 2.0 - See [LICENSE](LICENSE) for more information.
Apache 2.0 - See [LICENSE](LICENSE) for more information.
Loading

0 comments on commit 448ba9c

Please sign in to comment.