Skip to content

Commit

Permalink
Cleanup overmind source source handling
Browse files Browse the repository at this point in the history
instead of checking out current `main`, use the version requested in
the CLI's go.mod file. This keeps unrelated PRs from breaking when
sources are updated, while still ensuring that renovate PRs updating
the source references also have to update the generated files.
  • Loading branch information
DavidS-ovm committed Sep 2, 2024
1 parent ea25502 commit 6539911
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 42 deletions.
31 changes: 2 additions & 29 deletions .github/actions/go_init/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,35 +15,8 @@ runs:
check-latest: true
cache: ${{ inputs.cache }}

- name: Checkout
uses: actions/checkout@v4
with:
repository: overmindtech/aws-source
path: ./aws-source

- name: Checkout
uses: actions/checkout@v4
with:
repository: overmindtech/k8s-source
path: ./k8s-source

- name: Move sources in place
shell: bash
run: |
rm -rf ../aws-source
rm -rf ../k8s-source
mv -v aws-source ..
mv -v k8s-source ..
- name: Go Generate
- name: Get deps and refresh generated code
shell: bash
run: |
go get -v -t -d ./...
go generate ./...
if [ -z "$(git status --porcelain)" ]; then
echo "No pending changes from 'go generate'"
else
echo "Pending changes from 'go generate' found, please run 'go generate ./...' and commit the changes"
git status
exit 1
fi
cat cmd/commit.txt
2 changes: 0 additions & 2 deletions .github/workflows/e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ jobs:
- name: Build the binary
run: |
set -xe
go get -v -t -d ./...
go build -o overmind main.go
- name: Run E2E Tests
Expand Down Expand Up @@ -121,7 +120,6 @@ jobs:
- name: Build the binary
run: |
set -xe
go get -v -t -d ./...
go build -o overmind main.go
- name: Run E2E Tests
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@ jobs:
- name: Go Init
uses: ./.github/actions/go_init

- name: Get dependencies
run: |
go get -v -t -d ./...
- name: Go Test
run: |
go run main.go --version
Expand All @@ -38,6 +34,10 @@ jobs:
- name: Go Init
uses: ./.github/actions/go_init

- name: Check go generate output is clean
run: |
git diff --exit-code
# get .golangci.yml from github.com/overmindtech/golangci-lint_config
- name: Get .golangci.yml from github.com/overmindtech/golangci-lint_configs
run: |
Expand Down
7 changes: 4 additions & 3 deletions extractmaps.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"fmt"
"html/template"
"os"
"path/filepath"
"strings"
)

Expand All @@ -17,7 +18,7 @@ type Args struct {
}

func main() {
fmt.Printf("Running %s go on %s\n", os.Args[0], os.Getenv("GOFILE"))
fmt.Printf("Running %s from %s\n", os.Args[0], os.Getenv("GOFILE"))

cwd, err := os.Getwd()
if err != nil {
Expand All @@ -35,9 +36,9 @@ func main() {
}

args := Args{
Source: os.Args[1],
Source: filepath.Base(os.Args[1]),
SourceMunged: strings.ReplaceAll(os.Args[1], "-", ""),
Data: dataFromFiles(fmt.Sprintf("../sources/%v/docs-data", os.Args[1])),
Data: dataFromFiles(fmt.Sprintf("%v/docs-data", os.Args[1])),
}

funcMap := template.FuncMap{
Expand Down
1 change: 0 additions & 1 deletion sources/aws-source

This file was deleted.

1 change: 0 additions & 1 deletion sources/k8s-source

This file was deleted.

4 changes: 2 additions & 2 deletions tfutils/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"github.com/overmindtech/sdp-go"
)

//go:generate go run ../extractmaps.go aws-source
//go:generate go run ../extractmaps.go k8s-source
//go:generate bash -c "go run ../extractmaps.go $(go list -m -f '{{.Dir}}' github.com/overmindtech/aws-source)"
//go:generate bash -c "go run ../extractmaps.go $(go list -m -f '{{.Dir}}' github.com/overmindtech/k8s-source)"

type TfMapData struct {
// The overmind type name
Expand Down

0 comments on commit 6539911

Please sign in to comment.