Skip to content

Commit

Permalink
Merge pull request #1 from GoogleCloudPlatform/master
Browse files Browse the repository at this point in the history
Sync fork
  • Loading branch information
juliodiez authored Jan 11, 2023
2 parents b0fcc94 + adcfb51 commit 05d57e1
Show file tree
Hide file tree
Showing 1,743 changed files with 82,220 additions and 31,856 deletions.
44 changes: 44 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Copyright 2022 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
#
# http://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.

'on:blueprints':
- any:
- 'blueprints/**'
- '!**/*.md'

'on:documentation':
- any:
- '**/*.md'
- '!**/README.md'

- 'README.md'
- 'blueprints/README.md'
- 'blueprints/*/README.md'
- 'modules/README.md'
- 'fast/README.md'
- 'fast/stages/README.md'

'on:FAST':
- any:
- 'fast/**'
- '!**/*.md'

'on:modules':
- any:
- 'modules/**'
- '!**/*.md'

'on:tools':
- 'tools/**'
- '.github/**'
30 changes: 30 additions & 0 deletions .github/workflows/container-image-squid.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Copyright 2022 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
#
# http://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.

name: "Build and push the Squid container image"

on:
workflow_dispatch:
push:
branches:
- master
paths:
- 'modules/cloud-config-container/squid/docker/**'

jobs:
build-push-squid-container-image:
uses: ./.github/workflows/container-image.yml
with:
image_name: fabric-squid
docker_context: modules/cloud-config-container/squid/docker
30 changes: 30 additions & 0 deletions .github/workflows/container-image-strongswan.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Copyright 2022 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
#
# http://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.

name: "Build and push the strongSwan container image"

on:
workflow_dispatch:
push:
branches:
- master
paths:
- 'modules/cloud-config-container/onprem/docker-images/strongswan/**'

jobs:
build-push-strongswan-container-image:
uses: ./.github/workflows/container-image.yml
with:
image_name: fabric-strongswan
docker_context: modules/cloud-config-container/onprem/docker-images/strongswan
30 changes: 30 additions & 0 deletions .github/workflows/container-image-toolbox.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Copyright 2022 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
#
# http://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.

name: "Build and push the Toolbox container image"

on:
workflow_dispatch:
push:
branches:
- master
paths:
- 'modules/cloud-config-container/onprem/docker-images/toolbox/**'

jobs:
build-push-toolbox-container-image:
uses: ./.github/workflows/container-image.yml
with:
image_name: fabric-toolbox
docker_context: modules/cloud-config-container/onprem/docker-images/toolbox
66 changes: 66 additions & 0 deletions .github/workflows/container-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# Copyright 2022 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
#
# http://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.

name: "Build and push a generic container image"

on:
workflow_call:
inputs:
image_name:
required: true
type: string
docker_context:
required: true
type: string

permissions:
packages: write

env:
REGISTRY: ghcr.io

jobs:
build-push-generic-container-image:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Set image version
run: echo IMAGE_VERSION=$(date +'%Y%m%d') >> $GITHUB_ENV

- name: Normalise image name
run: echo IMAGE_NAME=$(echo '${{ github.repository_owner }}/${{ inputs.image_name }}' | tr '[:upper:]' '[:lower:]') >> $GITHUB_ENV

- name: Login to GHCR
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push
uses: docker/build-push-action@v3
with:
context: ${{ inputs.docker_context }}
push: true
tags: |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.IMAGE_VERSION }}
labels: |
org.opencontainers.image.licenses=Apache-2.0
org.opencontainers.image.revision=${{ github.sha }}
org.opencontainers.image.source=${{ github.server_url }}/${{ github.repository }}
org.opencontainers.image.title=${{ inputs.image_name }}
org.opencontainers.image.vendor=Google LLC
org.opencontainers.image.version=${{ env.IMAGE_VERSION }}
55 changes: 0 additions & 55 deletions .github/workflows/fast-tests.yml

This file was deleted.

30 changes: 30 additions & 0 deletions .github/workflows/labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Copyright 2022 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
#
# http://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.

name: "Label Pull Requests"

on:
pull_request_target:

jobs:
triage:
permissions:
contents: read
pull-requests: write
runs-on: ubuntu-latest
steps:
- uses: actions/labeler@v4
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
sync-labels: true
12 changes: 5 additions & 7 deletions .github/workflows/linting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ name: "Linting"
on:
pull_request:
branches:
- fast-dev
- fast-dev-gke
- master
tags:
- ci
Expand All @@ -32,12 +30,12 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: "3.9"
python-version: "3.10"

- name: Set up Terraform
uses: hashicorp/setup-terraform@v1
with:
terraform_version: 1.0.9
terraform_version: 1.3.2

- name: Install dependencies
run: |
Expand All @@ -53,12 +51,12 @@ jobs:
run: |
terraform fmt -recursive -check -diff $GITHUB_WORKSPACE
- name: Check documentation (fabric)
- name: Check documentation
id: documentation-fabric
run: |
python3 tools/check_documentation.py examples modules fast
python3 tools/check_documentation.py modules fast blueprints
- name: Check documentation links (fabric)
- name: Check documentation links
id: documentation-links-fabric
run: |
python3 tools/check_links.py .
Expand Down
65 changes: 65 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# Copyright 2022 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
#
# http://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.

name: |
Create a new release
on:
workflow_dispatch:
inputs:
version:
description: "Release version"
required: true
changelog:
description: "I have updated the CHANGELOG"
required: true
type: boolean

permissions:
contents: write

jobs:
release:
name: "Release new version"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: "Validate input"
run: |
[[ "${{ github.event.inputs.changelog }}" != "true" ]] && { echo 'You didn''t update the changelog.' ; exit 1; }
[[ -n "${{ github.event.inputs.version }}" ]] || { echo 'Version not specified!'; exit 1; }
[[ "${{ github.event.inputs.version }}" != v* ]] && { echo 'Version does not start with v!' ; exit 1; }
- uses: actions/setup-go@v3
with:
go-version: "1.16"

- name: "Update all module names"
run: |
cd tools/tfeditor
go build .
./tfeditor -path ../.. -module-name "google-pso-tool/cloud-foundation-fabric/{{ .Module }}/${{ github.event.inputs.version }}"
cd ../..
git config --global user.name "Release Automation"
git config --global user.email "[email protected]"
git commit -a -m "Release version ${{ github.event.inputs.version }}"
git push origin master
- name: "Tag and release"
run: |
git tag ${{ github.event.inputs.version }}
git push origin ${{ github.event.inputs.version }}
Loading

0 comments on commit 05d57e1

Please sign in to comment.