Skip to content

Commit

Permalink
Move the schema/ package to the toplevel
Browse files Browse the repository at this point in the history
Today, we have *three* Go modules in this repository:

- /
- schema/
- mantle/

And as of recently, both the toplevel / and mantle/ vendor the schema/.
This causes "vendor amplification", where a vendored dependency
of schema/ gets *triplicated*.

Now that gangplank/ is out of the picture, it makes sense to move
the bits from schema/ into the toplevel module.

This really helps make operating on coreos-assembler stuff
feel like a "first class" operation.

Also, we no longer have two copies of the schema file!
  • Loading branch information
cgwalters committed Sep 7, 2022
1 parent a1d59bd commit 6f26716
Show file tree
Hide file tree
Showing 419 changed files with 26 additions and 206,135 deletions.
6 changes: 0 additions & 6 deletions .github/workflows/lints.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,3 @@ jobs:
version: v1.46.2
working-directory: mantle
args: --timeout=5m
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: v1.46.2
working-directory: schema
args: --timeout=5m
18 changes: 8 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ tests_checked:=$(patsubst tests/%,tests/.%.shellchecked,${tests})
cwd:=$(shell find . -maxdepth 1 -type f -executable -print)
cwd_checked:=$(patsubst ./%,.%.shellchecked,${cwd})
GOARCH:=$(shell uname -m)
export COSA_META_SCHEMA:=$(shell pwd)/src/v1.json
export COSA_META_SCHEMA:=$(shell pwd)/schema/v1.json
ifeq ($(GOARCH),x86_64)
GOARCH="amd64"
else ifeq ($(GOARCH),aarch64)
Expand Down Expand Up @@ -86,22 +86,19 @@ schema:
$(MAKE) -C schema

# To update the coreos-assembler schema:
# Edit src/v1.json
# $ cp src/v1.json schema/
# Edit schema/v1.json
# $ make schema
# $ (cd mantle && go mod vendor)
.PHONY: schema-check
schema-check: DIGEST = $(shell sha256sum src/v1.json | awk '{print $$1}')
schema-check: DIGEST = $(shell sha256sum schema/v1.json | awk '{print $$1}')
schema-check:
# Are the JSON Schema copies synced with each other?
diff -u src/v1.json schema/v1.json
# Is the generated Go code synced with the schema?
grep -q "$(DIGEST)" schema/cosa/cosa_v1.go
grep -q "$(DIGEST)" schema/cosa/schema_doc.go
grep -q "$(DIGEST)" pkg/cosa/cosa_v1.go
grep -q "$(DIGEST)" pkg/cosa/schema_doc.go
# Are the vendored copies of the generated code synced with the
# canonical ones?
diff -u mantle/vendor/github.com/coreos/coreos-assembler-schema/cosa/cosa_v1.go schema/cosa/cosa_v1.go
diff -u mantle/vendor/github.com/coreos/coreos-assembler-schema/cosa/schema_doc.go schema/cosa/schema_doc.go
diff -u mantle/vendor/github.com/coreos/coreos-assembler/pkg/cosa/cosa_v1.go pkg/cosa/cosa_v1.go
diff -u mantle/vendor/github.com/coreos/coreos-assembler/pkg/cosa/schema_doc.go pkg/cosa/schema_doc.go

install:
install -d $(DESTDIR)$(PREFIX)/lib/coreos-assembler
Expand All @@ -111,6 +108,7 @@ install:
cp -df -t $(DESTDIR)$(PREFIX)/lib/coreos-assembler/ci $$(find ci/ -maxdepth 1 -type f)
install -d $(DESTDIR)$(PREFIX)/lib/coreos-assembler/cosalib
install -D -t $(DESTDIR)$(PREFIX)/lib/coreos-assembler/cosalib $$(find src/cosalib/ -maxdepth 1 -type f)
install -t $(DESTDIR)$(PREFIX)/lib/coreos-assembler schema/v1.json
install -d $(DESTDIR)$(PREFIX)/bin
install bin/coreos-assembler $(DESTDIR)$(PREFIX)/bin/
ln -sf ../lib/coreos-assembler/cp-reflink $(DESTDIR)$(PREFIX)/bin/
Expand Down
2 changes: 1 addition & 1 deletion cmd/build-extensions-container.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"fmt"
"os/exec"

"github.com/coreos/coreos-assembler-schema/cosa"
"github.com/coreos/coreos-assembler/pkg/cosa"
"github.com/coreos/coreos-assembler/internal/pkg/cosash"

"crypto/sha256"
Expand Down
9 changes: 3 additions & 6 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,15 @@ go 1.17
require github.com/spf13/cobra v1.5.0

require (
github.com/pkg/errors v0.9.1 // indirect
github.com/sirupsen/logrus v1.9.0 // indirect
github.com/pkg/errors v0.9.1
github.com/sirupsen/logrus v1.9.0
github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f // indirect
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
github.com/xeipuuv/gojsonschema v1.2.0 // indirect
github.com/xeipuuv/gojsonschema v1.2.0
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f // indirect
)

require (
github.com/coreos/coreos-assembler-schema v0.0.0-00010101000000-000000000000
github.com/inconshreveable/mousetrap v1.0.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
)

replace github.com/coreos/coreos-assembler-schema => ./schema
2 changes: 1 addition & 1 deletion mantle/cmd/kola/kola.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import (
"github.com/pkg/errors"
"github.com/spf13/cobra"

"github.com/coreos/coreos-assembler-schema/cosa"
"github.com/coreos/coreos-assembler/pkg/cosa"
"github.com/coreos/mantle/cli"
"github.com/coreos/mantle/fcos"
"github.com/coreos/mantle/harness/reporters"
Expand Down
4 changes: 2 additions & 2 deletions mantle/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ require (
github.com/aliyun/aliyun-oss-go-sdk v2.0.3+incompatible
github.com/aws/aws-sdk-go v1.34.28
github.com/coreos/butane v0.15.0
github.com/coreos/coreos-assembler-schema v0.0.0-00010101000000-000000000000
github.com/coreos/coreos-assembler v0.14.0
github.com/coreos/go-semver v0.3.0
github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e
github.com/coreos/go-systemd/v22 v22.0.0
Expand Down Expand Up @@ -85,6 +85,6 @@ require (
)

replace (
github.com/coreos/coreos-assembler-schema => ../schema
github.com/coreos/coreos-assembler => ../
google.golang.org/cloud => cloud.google.com/go v0.0.0-20190220171618-cbb15e60dc6d
)
2 changes: 1 addition & 1 deletion mantle/kola/tests/rhcos/upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
"strings"
"time"

"github.com/coreos/coreos-assembler-schema/cosa"
"github.com/coreos/coreos-assembler/pkg/cosa"
"github.com/coreos/mantle/kola"
"github.com/coreos/mantle/kola/cluster"
"github.com/coreos/mantle/kola/register"
Expand Down
2 changes: 1 addition & 1 deletion mantle/util/distros.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (
"path/filepath"
"strings"

"github.com/coreos/coreos-assembler-schema/cosa"
"github.com/coreos/coreos-assembler/pkg/cosa"
)

// TargetDistroFromName returns the distribution given
Expand Down
2 changes: 1 addition & 1 deletion mantle/util/repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (

"github.com/pkg/errors"

"github.com/coreos/coreos-assembler-schema/cosa"
"github.com/coreos/coreos-assembler/pkg/cosa"
)

const (
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions mantle/vendor/modules.txt

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
15 changes: 0 additions & 15 deletions schema/go.mod

This file was deleted.

25 changes: 0 additions & 25 deletions schema/go.sum

This file was deleted.

24 changes: 0 additions & 24 deletions schema/vendor/github.com/pkg/errors/.gitignore

This file was deleted.

10 changes: 0 additions & 10 deletions schema/vendor/github.com/pkg/errors/.travis.yml

This file was deleted.

23 changes: 0 additions & 23 deletions schema/vendor/github.com/pkg/errors/LICENSE

This file was deleted.

44 changes: 0 additions & 44 deletions schema/vendor/github.com/pkg/errors/Makefile

This file was deleted.

59 changes: 0 additions & 59 deletions schema/vendor/github.com/pkg/errors/README.md

This file was deleted.

Loading

0 comments on commit 6f26716

Please sign in to comment.