Skip to content

Commit 6a89503

Browse files
committed
Move the schema/ package to the toplevel
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!
1 parent c7fb302 commit 6a89503

File tree

420 files changed

+40
-206149
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

420 files changed

+40
-206149
lines changed

.github/workflows/lints.yml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,3 @@ jobs:
3636
version: v1.46.2
3737
working-directory: mantle
3838
args: --timeout=5m
39-
- name: golangci-lint
40-
uses: golangci/golangci-lint-action@v3
41-
with:
42-
version: v1.46.2
43-
working-directory: schema
44-
args: --timeout=5m

Makefile

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ tests_checked:=$(patsubst tests/%,tests/.%.shellchecked,${tests})
2323
cwd:=$(shell find . -maxdepth 1 -type f -executable -print)
2424
cwd_checked:=$(patsubst ./%,.%.shellchecked,${cwd})
2525
GOARCH:=$(shell uname -m)
26-
export COSA_META_SCHEMA:=$(shell pwd)/src/v1.json
26+
export COSA_META_SCHEMA:=$(shell pwd)/schema/v1.json
2727
ifeq ($(GOARCH),x86_64)
2828
GOARCH="amd64"
2929
else ifeq ($(GOARCH),aarch64)
@@ -86,22 +86,19 @@ schema:
8686
$(MAKE) -C schema
8787

8888
# To update the coreos-assembler schema:
89-
# Edit src/v1.json
90-
# $ cp src/v1.json schema/
89+
# Edit schema/v1.json
9190
# $ make schema
9291
# $ (cd mantle && go mod vendor)
9392
.PHONY: schema-check
94-
schema-check: DIGEST = $(shell sha256sum src/v1.json | awk '{print $$1}')
93+
schema-check: DIGEST = $(shell sha256sum schema/v1.json | awk '{print $$1}')
9594
schema-check:
96-
# Are the JSON Schema copies synced with each other?
97-
diff -u src/v1.json schema/v1.json
9895
# Is the generated Go code synced with the schema?
99-
grep -q "$(DIGEST)" schema/cosa/cosa_v1.go
100-
grep -q "$(DIGEST)" schema/cosa/schema_doc.go
96+
grep -q "$(DIGEST)" pkg/builds/cosa_v1.go
97+
grep -q "$(DIGEST)" pkg/builds/schema_doc.go
10198
# Are the vendored copies of the generated code synced with the
10299
# canonical ones?
103-
diff -u mantle/vendor/github.com/coreos/coreos-assembler-schema/cosa/cosa_v1.go schema/cosa/cosa_v1.go
104-
diff -u mantle/vendor/github.com/coreos/coreos-assembler-schema/cosa/schema_doc.go schema/cosa/schema_doc.go
100+
diff -u mantle/vendor/github.com/coreos/coreos-assembler/pkg/builds/cosa_v1.go pkg/builds/cosa_v1.go
101+
diff -u mantle/vendor/github.com/coreos/coreos-assembler/pkg/builds/schema_doc.go pkg/builds/schema_doc.go
105102

106103
install:
107104
install -d $(DESTDIR)$(PREFIX)/lib/coreos-assembler
@@ -111,6 +108,7 @@ install:
111108
cp -df -t $(DESTDIR)$(PREFIX)/lib/coreos-assembler/ci $$(find ci/ -maxdepth 1 -type f)
112109
install -d $(DESTDIR)$(PREFIX)/lib/coreos-assembler/cosalib
113110
install -D -t $(DESTDIR)$(PREFIX)/lib/coreos-assembler/cosalib $$(find src/cosalib/ -maxdepth 1 -type f)
111+
install -t $(DESTDIR)$(PREFIX)/lib/coreos-assembler schema/v1.json
114112
install -d $(DESTDIR)$(PREFIX)/bin
115113
install bin/coreos-assembler $(DESTDIR)$(PREFIX)/bin/
116114
ln -sf ../lib/coreos-assembler/cp-reflink $(DESTDIR)$(PREFIX)/bin/

cmd/build-extensions-container.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import (
44
"fmt"
55
"os/exec"
66

7-
"github.com/coreos/coreos-assembler-schema/cosa"
87
"github.com/coreos/coreos-assembler/internal/pkg/cosash"
8+
cosa "github.com/coreos/coreos-assembler/pkg/builds"
99

1010
"crypto/sha256"
1111
"encoding/json"

go.mod

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,15 @@ go 1.17
55
require github.com/spf13/cobra v1.5.0
66

77
require (
8-
github.com/pkg/errors v0.9.1 // indirect
9-
github.com/sirupsen/logrus v1.9.0 // indirect
8+
github.com/pkg/errors v0.9.1
9+
github.com/sirupsen/logrus v1.9.0
1010
github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f // indirect
1111
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
12-
github.com/xeipuuv/gojsonschema v1.2.0 // indirect
12+
github.com/xeipuuv/gojsonschema v1.2.0
1313
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f // indirect
1414
)
1515

1616
require (
17-
github.com/coreos/coreos-assembler-schema v0.0.0-00010101000000-000000000000
1817
github.com/inconshreveable/mousetrap v1.0.0 // indirect
1918
github.com/spf13/pflag v1.0.5 // indirect
2019
)
21-
22-
replace github.com/coreos/coreos-assembler-schema => ./schema

mantle/cmd/kola/kola.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ import (
3131
"github.com/pkg/errors"
3232
"github.com/spf13/cobra"
3333

34-
"github.com/coreos/coreos-assembler-schema/cosa"
34+
cosa "github.com/coreos/coreos-assembler/pkg/builds"
3535
"github.com/coreos/mantle/cli"
3636
"github.com/coreos/mantle/fcos"
3737
"github.com/coreos/mantle/harness/reporters"

mantle/go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ require (
1212
github.com/aliyun/aliyun-oss-go-sdk v2.0.3+incompatible
1313
github.com/aws/aws-sdk-go v1.34.28
1414
github.com/coreos/butane v0.15.0
15-
github.com/coreos/coreos-assembler-schema v0.0.0-00010101000000-000000000000
15+
github.com/coreos/coreos-assembler v0.14.0
1616
github.com/coreos/go-semver v0.3.0
1717
github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e
1818
github.com/coreos/go-systemd/v22 v22.0.0
@@ -85,6 +85,6 @@ require (
8585
)
8686

8787
replace (
88-
github.com/coreos/coreos-assembler-schema => ../schema
88+
github.com/coreos/coreos-assembler => ../
8989
google.golang.org/cloud => cloud.google.com/go v0.0.0-20190220171618-cbb15e60dc6d
9090
)

mantle/kola/tests/rhcos/upgrade.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import (
2424
"strings"
2525
"time"
2626

27-
"github.com/coreos/coreos-assembler-schema/cosa"
27+
cosa "github.com/coreos/coreos-assembler/pkg/builds"
2828
"github.com/coreos/mantle/kola"
2929
"github.com/coreos/mantle/kola/cluster"
3030
"github.com/coreos/mantle/kola/register"

mantle/util/distros.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import (
1919
"path/filepath"
2020
"strings"
2121

22-
"github.com/coreos/coreos-assembler-schema/cosa"
22+
"github.com/coreos/coreos-assembler/pkg/builds"
2323
)
2424

2525
// TargetDistroFromName returns the distribution given
@@ -34,7 +34,7 @@ func TargetDistroFromName(artifact string) string {
3434
}
3535

3636
// TargetDistro returns the distribution of a cosa build
37-
func TargetDistro(build *cosa.Build) (string, error) {
37+
func TargetDistro(build *builds.Build) (string, error) {
3838
switch build.Name {
3939
case "rhcos":
4040
return "rhcos", nil

mantle/util/repo.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import (
2222

2323
"github.com/pkg/errors"
2424

25-
"github.com/coreos/coreos-assembler-schema/cosa"
25+
cosa "github.com/coreos/coreos-assembler/pkg/builds"
2626
)
2727

2828
const (

mantle/vendor/github.com/coreos/coreos-assembler-schema/cosa/schema.go

Lines changed: 0 additions & 79 deletions
This file was deleted.

schema/vendor/github.com/xeipuuv/gojsonschema/LICENSE-APACHE-2.0.txt renamed to mantle/vendor/github.com/coreos/coreos-assembler/LICENSE

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

mantle/vendor/github.com/coreos/coreos-assembler-schema/cosa/build.go renamed to mantle/vendor/github.com/coreos/coreos-assembler/pkg/builds/build.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

schema/cosa/builds.go renamed to mantle/vendor/github.com/coreos/coreos-assembler/pkg/builds/builds.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/coreos/coreos-assembler-schema/cosa/cosa_v1.go renamed to mantle/vendor/github.com/coreos/coreos-assembler/pkg/builds/cosa_v1.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/coreos/coreos-assembler-schema/cosa/schema.go renamed to mantle/vendor/github.com/coreos/coreos-assembler/pkg/builds/schema.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

mantle/vendor/github.com/coreos/coreos-assembler-schema/cosa/schema_doc.go renamed to mantle/vendor/github.com/coreos/coreos-assembler/pkg/builds/schema_doc.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

mantle/vendor/modules.txt

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

schema/cosa/build.go renamed to pkg/builds/build.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
package cosa
15+
package builds
1616

1717
import (
1818
"encoding/json"
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package cosa
1+
package builds
22

33
import (
44
"bytes"

schema/cosa/builds_test.go renamed to pkg/builds/builds_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package cosa
1+
package builds
22

33
import (
44
"io/ioutil"
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package cosa
1+
package builds
22

33
// generated by 'make schema'
44
// source hash: 144450d458f89f637ca487d353af3dfd60096ddbf3179da8e2b42b2bd2d0a6eb

schema/cosa/schema.go renamed to pkg/builds/schema.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package cosa
1+
package builds
22

33
import (
44
"encoding/json"

schema/cosa/schema_doc.go renamed to pkg/builds/schema_doc.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Source hash: 144450d458f89f637ca487d353af3dfd60096ddbf3179da8e2b42b2bd2d0a6eb
33
// DO NOT EDIT
44

5-
package cosa
5+
package builds
66

77
var generatedSchemaJSON = `{
88
"definitions": {

schema/cosa/schema_test.go renamed to pkg/builds/schema_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package cosa
1+
package builds
22

33
import (
44
"bytes"

0 commit comments

Comments
 (0)