Skip to content

Commit

Permalink
Make not-generated Terraform resources CSV available as a Github work…
Browse files Browse the repository at this point in the history
…flow artifact

Signed-off-by: Alper Rifat Ulucinar <ulucinar@users.noreply.github.com>
  • Loading branch information
ulucinar committed Nov 10, 2022
1 parent ef6cf22 commit 181cc42
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 5 deletions.
16 changes: 14 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,19 @@ jobs:
run: make vendor vendor.check

- name: Check Diff
run: make check-diff
run: |
mkdir _output
make check-diff
env:
# check-diff depends on the generate Make target, and we would like
# to save a skipped resource list
SKIPPED_RESOURCES_CSV: ../_output/skipped_resources.csv

- name: Publish skipped resources CSV to Github
uses: actions/upload-artifact@v3
with:
name: skipped_resources
path: _output/skipped_resources.csv

unit-tests:
runs-on: ubuntu-22.04
Expand Down Expand Up @@ -236,7 +248,7 @@ jobs:
BUILD_ARGS: "--load"

- name: Publish Artifacts to GitHub
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: output
path: _output/**
Expand Down
9 changes: 8 additions & 1 deletion cmd/generator/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"fmt"
"os"
"path/filepath"
"strings"

"github.com/upbound/upjet/pkg/pipeline"

Expand All @@ -23,5 +24,11 @@ func main() {
if err != nil {
panic(fmt.Sprintf("cannot calculate the absolute path with %s", rootDir))
}
pipeline.Run(config.GetProvider(), absRootDir)
p := config.GetProvider()
pipeline.Run(p, absRootDir)
if fp := os.Getenv("SKIPPED_RESOURCES_CSV"); len(fp) != 0 {
if err := os.WriteFile(fp, []byte(strings.Join(p.GetSkippedResourceNames(), ",")), 0o600); err != nil {
panic(fmt.Sprintf("cannot write skipped resources CSV to file %s: %s", fp, err.Error()))
}
}
}
2 changes: 2 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -157,3 +157,5 @@ require (
sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect
sigs.k8s.io/yaml v1.3.0 // indirect
)

replace github.com/upbound/upjet => github.com/ulucinar/upbound-upjet v0.0.0-20221110144831-17aa3b94b882
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -686,8 +686,8 @@ github.com/tmc/grpc-websocket-proxy v0.0.0-20201229170055-e5319fda7802/go.mod h1
github.com/tmccombs/hcl2json v0.3.3 h1:+DLNYqpWE0CsOQiEZu+OZm5ZBImake3wtITYxQ8uLFQ=
github.com/tmccombs/hcl2json v0.3.3/go.mod h1:Y2chtz2x9bAeRTvSibVRVgbLJhLJXKlUeIvjeVdnm4w=
github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM=
github.com/upbound/upjet v0.8.0-rc.0.0.20221024111721-c82119f5ef34 h1:TXehSax5YEurPY8vMnRx7n8xIHENGAiOhISxxqthcX0=
github.com/upbound/upjet v0.8.0-rc.0.0.20221024111721-c82119f5ef34/go.mod h1:QyDjh8h49niORvHLHZE8ZS4fiCa6Dkcsw3aBJBfK3I8=
github.com/ulucinar/upbound-upjet v0.0.0-20221110144831-17aa3b94b882 h1:X8sBFqLPia9Wd5HB6CzdoGpwtZNd9wH2hv8x4nuCYCk=
github.com/ulucinar/upbound-upjet v0.0.0-20221110144831-17aa3b94b882/go.mod h1:QyDjh8h49niORvHLHZE8ZS4fiCa6Dkcsw3aBJBfK3I8=
github.com/vmihailenco/msgpack v3.3.3+incompatible/go.mod h1:fy3FlTQTDXWkZ7Bh6AcGMlsjHatGryHQYUTf1ShIgkk=
github.com/vmihailenco/msgpack v4.0.4+incompatible h1:dSLoQfGFAo3F6OoNhwUmLwVgaUXK79GlxNBwueZn0xI=
github.com/vmihailenco/msgpack v4.0.4+incompatible/go.mod h1:fy3FlTQTDXWkZ7Bh6AcGMlsjHatGryHQYUTf1ShIgkk=
Expand Down

0 comments on commit 181cc42

Please sign in to comment.