Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build the provider in github #9351

Merged
merged 59 commits into from
Nov 15, 2023
Merged
Changes from 1 commit
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
6017f3b
test building the provider in github
ScottSuarez Oct 25, 2023
4c25393
updoot
ScottSuarez Oct 25, 2023
09e4e09
merp
ScottSuarez Oct 25, 2023
a5b208e
merp
ScottSuarez Oct 25, 2023
b96b513
merp
ScottSuarez Oct 25, 2023
08bc08c
improve bundle cache
ScottSuarez Oct 25, 2023
2a6cfca
build all downstreams
ScottSuarez Oct 27, 2023
581dbd4
fix individual build downstreams
ScottSuarez Oct 27, 2023
c9e4214
fix doc builder
ScottSuarez Oct 27, 2023
1839b20
supress output of git rm.. too noisy
ScottSuarez Oct 27, 2023
77ae4a2
test matrixes
ScottSuarez Oct 28, 2023
53d801a
meep
ScottSuarez Oct 28, 2023
f72e753
meep
ScottSuarez Oct 28, 2023
c53d033
meep
ScottSuarez Oct 28, 2023
427aaa5
echo output
ScottSuarez Oct 28, 2023
d28e910
meerp
ScottSuarez Oct 28, 2023
f63d24b
build
ScottSuarez Oct 28, 2023
dfd132f
update make file
ScottSuarez Oct 30, 2023
300e2b4
output-path
ScottSuarez Oct 30, 2023
52780e8
fix make file
ScottSuarez Oct 30, 2023
44d2161
simplify build script to use make commands
ScottSuarez Oct 30, 2023
178de0f
tgc generation simplified
ScottSuarez Oct 30, 2023
474066d
retain old base build pathway
ScottSuarez Oct 30, 2023
954b5fa
retain old base build pathway
ScottSuarez Oct 30, 2023
ee8080e
more verbose logging
ScottSuarez Oct 30, 2023
bf0bb30
fix syntax errors
ScottSuarez Oct 30, 2023
d07ac92
fix build script for ga version
ScottSuarez Oct 31, 2023
c3ffc35
commit working env
ScottSuarez Oct 31, 2023
0da2a2e
Update GNUmakefile
ScottSuarez Nov 1, 2023
49f62d9
revert changes to ruby version
ScottSuarez Nov 1, 2023
b5256de
Merge branch 'pgh' of https://github.com/ScottSuarez/magic-modules in…
ScottSuarez Nov 1, 2023
3003f97
Merge branch 'main' of https://github.com/GoogleCloudPlatform/magic-m…
ScottSuarez Nov 2, 2023
b3e7903
Run tests
ScottSuarez Nov 2, 2023
46afdc6
add dependency
ScottSuarez Nov 2, 2023
bae7e57
edit downstreams
ScottSuarez Nov 3, 2023
b721b97
fix yaml
ScottSuarez Nov 3, 2023
1045ea1
simplify output statement
ScottSuarez Nov 3, 2023
4fc81f9
lets see if this works
ScottSuarez Nov 3, 2023
b894d09
fix workflow
ScottSuarez Nov 3, 2023
1176b97
revert
ScottSuarez Nov 3, 2023
72a028f
small typo
ScottSuarez Nov 3, 2023
39b148c
split to workflow files
ScottSuarez Nov 3, 2023
3abafe3
remove workflow run file
ScottSuarez Nov 3, 2023
d0758c9
test better naming conventions (might not work)
ScottSuarez Nov 3, 2023
2164ab6
more name convention alignments
ScottSuarez Nov 3, 2023
6ce314d
generation checkin
ScottSuarez Nov 3, 2023
bc14131
tgc unit test fix
ScottSuarez Nov 3, 2023
360a642
replace wiht local provider
ScottSuarez Nov 3, 2023
ffe5c66
extract tpgb into go path
ScottSuarez Nov 3, 2023
4c42791
tgc unit tests
ScottSuarez Nov 3, 2023
bb4a38b
fix typo
ScottSuarez Nov 3, 2023
00c539c
gnumake
ScottSuarez Nov 7, 2023
db896db
Update GNUmakefile
ScottSuarez Nov 7, 2023
c0fec6e
Update .github/workflows/unit-test-tpg.yml
ScottSuarez Nov 7, 2023
ac68661
merge with main
ScottSuarez Nov 7, 2023
1a4758d
Merge branch 'main' of https://github.com/GoogleCloudPlatform/magic-m…
ScottSuarez Nov 14, 2023
cba768c
apply suggestions from review
ScottSuarez Nov 14, 2023
d7ab1ef
correct syntax error on Make file
ScottSuarez Nov 15, 2023
c27dbeb
Update .github/workflows/downstreams.yml
ScottSuarez Nov 15, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
build all downstreams
  • Loading branch information
ScottSuarez committed Oct 27, 2023
commit 2a6cfca8d5975eb351055d6b498c7827f2c2d8c6
259 changes: 256 additions & 3 deletions .github/workflows/build-downstream.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: magic-modules
name: build-downstreams

permissions: read-all

Expand All @@ -7,6 +7,93 @@ on:

jobs:
terraform-provider-google:
runs-on: ubuntu-22.04
env:
BASE_BRANCH: main
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Checkout Repository
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Set up Ruby
uses: ruby/setup-ruby@ec02537da5712d66d4d50a0f33b7eb52773b5ed1
with:
ruby-version: '3.1'

- name: Cache Bundler gems
uses: actions/cache@v2
with:
path: mmv1/vendor/bundle
key: ${{ runner.os }}-gems-${{ hashFiles('mmv1/**/Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-gems-

- name: Install Ruby dependencies
run: |
bundle config path mmv1/vendor/bundle
bundle install
working-directory: mmv1

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '^1.19'

# Cache Go modules
- name: Cache Go modules
uses: actions/cache@v2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-

- run: go install golang.org/x/tools/cmd/goimports@latest

- name: Build terraform-provider-google-beta
run: |
set -e
set -x
# Set GOPATH to a directory the runner user has access to
export GOPATH=~/go

function clone_repo() {
UPSTREAM_OWNER=hashicorp
GH_REPO=terraform-provider-google
LOCAL_PATH=$GOPATH/src/github.com/$UPSTREAM_OWNER/$GH_REPO
GITHUB_PATH=https://x-access-token:$GITHUB_TOKEN@github.com/$UPSTREAM_OWNER/$GH_REPO
mkdir -p "$(dirname $LOCAL_PATH)"
git clone $GITHUB_PATH $LOCAL_PATH --branch $BASE_BRANCH
}

if [ -z "$GITHUB_TOKEN" ]; then
echo "GITHUB_TOKEN environment variable is missing."
exit 1
fi

clone_repo

git config --local user.name "Modular Magician"
git config --local user.email "magic-modules@google.com"

pushd mmv1

pushd $LOCAL_PATH
go mod download
find . -type f -not -wholename "./.git*" -not -wholename "./.changelog*" -not -name ".travis.yml" -not -name ".golangci.yml" -not -name "CHANGELOG.md" -not -name "CHANGELOG_v*.md" -not -name "GNUmakefile" -not -name "docscheck.sh" -not -name "LICENSE" -not -name "README.md" -not -wholename "./examples*" -not -name ".go-version" -not -name ".hashibot.hcl" -print0 | xargs -0 git rm
popd

# Extracted build process from the script:
bundle exec compiler.rb -a -e terraform -o $LOCAL_PATH -v ga --no-docs
bundle exec compiler.rb -a -e terraform -o $LOCAL_PATH -v ga --no-code
pushd ../
make tpgtools OUTPUT_PATH=$LOCAL_PATH VERSION=beta
make teamcity-servicemap-generate OUTPUT_PATH=$LOCAL_PATH VERSION=beta
popd
popd
terraform-provider-google-beta:
runs-on: ubuntu-22.04
env:
BASE_BRANCH: main
Expand Down Expand Up @@ -62,8 +149,8 @@ jobs:
function clone_repo() {
UPSTREAM_OWNER=hashicorp
GH_REPO=terraform-provider-google-beta
LOCAL_PATH=$GOPATH/src/github.com/hashicorp/terraform-provider-google-beta
GITHUB_PATH=https://modular-magician:$GITHUB_TOKEN@github.com/$UPSTREAM_OWNER/$GH_REPO
LOCAL_PATH=$GOPATH/src/github.com/$UPSTREAM_OWNER/$GH_REPO
GITHUB_PATH=https://x-access-token:$GITHUB_TOKEN@github.com/$UPSTREAM_OWNER/$GH_REPO
mkdir -p "$(dirname $LOCAL_PATH)"
git clone $GITHUB_PATH $LOCAL_PATH --branch $BASE_BRANCH
}
Expand Down Expand Up @@ -91,5 +178,171 @@ jobs:
make tpgtools OUTPUT_PATH=$LOCAL_PATH VERSION=beta
make teamcity-servicemap-generate OUTPUT_PATH=$LOCAL_PATH VERSION=beta
popd
popd
terraform-google-conversion:
runs-on: ubuntu-22.04
env:
BASE_BRANCH: main
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Checkout Repository
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Set up Ruby
uses: ruby/setup-ruby@ec02537da5712d66d4d50a0f33b7eb52773b5ed1
with:
ruby-version: '3.1'

- name: Cache Bundler gems
uses: actions/cache@v2
with:
path: mmv1/vendor/bundle
key: ${{ runner.os }}-gems-${{ hashFiles('mmv1/**/Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-gems-

- name: Install Ruby dependencies
run: |
bundle config path mmv1/vendor/bundle
bundle install
working-directory: mmv1

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '^1.19'

# Cache Go modules
- name: Cache Go modules
uses: actions/cache@v2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-

- run: go install golang.org/x/tools/cmd/goimports@latest

- name: Build terraform-google-conversion
run: |
set -e
set -x
# Set GOPATH to a directory the runner user has access to
export GOPATH=~/go

function clone_repo() {
UPSTREAM_OWNER=GoogleCloudPlatform
GH_REPO=terraform-google-conversion
LOCAL_PATH=$GOPATH/src/github.com/$UPSTREAM_OWNER/$GH_REPO
GITHUB_PATH=https://x-access-token:$GITHUB_TOKEN@github.com/$UPSTREAM_OWNER/$GH_REPO
mkdir -p "$(dirname $LOCAL_PATH)"
git clone $GITHUB_PATH $LOCAL_PATH --branch $BASE_BRANCH
}

if [ -z "$GITHUB_TOKEN" ]; then
echo "GITHUB_TOKEN environment variable is missing."
exit 1
fi

clone_repo

git config --local user.name "Modular Magician"
git config --local user.email "magic-modules@google.com"

pushd mmv1

pushd $LOCAL_PATH
# clear out the templates as they are copied during
# generation from mmv1/third_party/validator/tests/data
rm -rf ./tfplan2cai/testdata/templates/
rm -rf ./tfplan2cai/testdata/generatedconvert/
rm -rf ./tfplan2cai/converters/google/provider
rm -rf ./tfplan2cai/converters/google/resources
find ./tfplan2cai/test/** -type f -exec git rm {} \;
popd

bundle exec compiler.rb -a -e terraform -f validator -o $LOCAL_PATH/tfplan2cai -v $VERSION

popd
docs-examples:
runs-on: ubuntu-22.04
env:
BASE_BRANCH: main
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Checkout Repository
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Set up Ruby
uses: ruby/setup-ruby@ec02537da5712d66d4d50a0f33b7eb52773b5ed1
with:
ruby-version: '3.1'

- name: Cache Bundler gems
uses: actions/cache@v2
with:
path: mmv1/vendor/bundle
key: ${{ runner.os }}-gems-${{ hashFiles('mmv1/**/Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-gems-

- name: Install Ruby dependencies
run: |
bundle config path mmv1/vendor/bundle
bundle install
working-directory: mmv1

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '^1.19'

# Cache Go modules
- name: Cache Go modules
uses: actions/cache@v2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-

- run: go install golang.org/x/tools/cmd/goimports@latest

- name: Build docs-examples
run: |
set -e
set -x
# Set GOPATH to a directory the runner user has access to
export GOPATH=~/go

function clone_repo() {
UPSTREAM_OWNER=terraform-google-modules
GH_REPO=docs-examples
LOCAL_PATH=$GOPATH/src/github.com/$UPSTREAM_OWNER/$GH_REPO
GITHUB_PATH=https://x-access-token:$GITHUB_TOKEN@github.com/$UPSTREAM_OWNER/$GH_REPO
mkdir -p "$(dirname $LOCAL_PATH)"
git clone $GITHUB_PATH $LOCAL_PATH --branch $BASE_BRANCH
}

if [ -z "$GITHUB_TOKEN" ]; then
echo "GITHUB_TOKEN environment variable is missing."
exit 1
fi

clone_repo

git config --local user.name "Modular Magician"
git config --local user.email "magic-modules@google.com"

pushd mmv1

# Generate for tf-oics
echo "Generating for tf-oics..."
bundle exec compiler.rb -a -e terraform -f oics -o $LOCAL_PATH

popd
echo "Build completed!"
Loading