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

Move the schema/ package to the toplevel #3069

Merged
merged 2 commits into from
Sep 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
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
11 changes: 4 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -87,21 +87,18 @@ schema:

# To update the coreos-assembler schema:
# Edit src/v1.json
# $ cp src/v1.json schema/
# $ make schema
# $ (cd mantle && go mod vendor)
.PHONY: schema-check
schema-check: DIGEST = $(shell sha256sum src/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/builds/cosa_v1.go
grep -q "$(DIGEST)" pkg/builds/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/builds/cosa_v1.go pkg/builds/cosa_v1.go
diff -u mantle/vendor/github.com/coreos/coreos-assembler/pkg/builds/schema_doc.go pkg/builds/schema_doc.go

install:
install -d $(DESTDIR)$(PREFIX)/lib/coreos-assembler
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,8 +4,8 @@ import (
"fmt"
"os/exec"

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

"crypto/sha256"
"encoding/json"
Expand Down
14 changes: 7 additions & 7 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,21 @@ module github.com/coreos/coreos-assembler

go 1.17

require github.com/spf13/cobra v1.5.0
require (
github.com/coreos/stream-metadata-go v0.4.0
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
10 changes: 8 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
github.com/coreos/stream-metadata-go v0.4.0 h1:0OSYc0Q43lveZCzS8AvpWK+fgIMwDW+dwQYH56hSfBY=
github.com/coreos/stream-metadata-go v0.4.0/go.mod h1:clbqsP1PUHnpmZHqn7mMOB/ZU+RFa3MxpAmcvE+FJkU=
github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
Expand All @@ -16,9 +18,12 @@ github.com/spf13/cobra v1.5.0/go.mod h1:dWXEIy2H428czQCjInthrTRUg7yKbok+2Qi/yBIJ
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk=
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f h1:J9EGpcZtP0E/raorCMxlFGSTBrsSlaDGf3jU/qvAE2c=
github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU=
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 h1:EzJWgHovont7NscjpAxXsDA8S8BMYve8Y5+7cuRE7R0=
Expand All @@ -30,5 +35,6 @@ golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f h1:v4INt8xihDGvnrfjMDVXGxw9w
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
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"
cosa "github.com/coreos/coreos-assembler/pkg/builds"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

random aside: I'm wondering if we should not rename the import here.. not sure. I'm definitely don't have this all in my head.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a matter of taste; I chose not to here to avoid inflating the diff more. Probably in most code we wouldn't rename it though.

"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"
cosa "github.com/coreos/coreos-assembler/pkg/builds"
"github.com/coreos/mantle/kola"
"github.com/coreos/mantle/kola/cluster"
"github.com/coreos/mantle/kola/register"
Expand Down
4 changes: 2 additions & 2 deletions 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/builds"
)

// TargetDistroFromName returns the distribution given
Expand All @@ -34,7 +34,7 @@ func TargetDistroFromName(artifact string) string {
}

// TargetDistro returns the distribution of a cosa build
func TargetDistro(build *cosa.Build) (string, error) {
func TargetDistro(build *builds.Build) (string, error) {
switch build.Name {
case "rhcos":
return "rhcos", nil
Expand Down
2 changes: 1 addition & 1 deletion mantle/util/repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (

"github.com/pkg/errors"

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

const (
Expand Down

This file was deleted.

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

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

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

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

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

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.

10 changes: 3 additions & 7 deletions schema/cosa/build.go → pkg/builds/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

package cosa
package builds

import (
"encoding/json"
Expand All @@ -24,12 +24,12 @@ import (
"path/filepath"
"reflect"
"regexp"
"runtime"
"sort"
"strings"

"github.com/pkg/errors"
log "github.com/sirupsen/logrus"
coreosarch "github.com/coreos/stream-metadata-go/arch"
)

var (
Expand Down Expand Up @@ -67,11 +67,7 @@ func BuilderArch() string {
if forceArch != "" {
return forceArch
}
arch := runtime.GOARCH
if arch == "amd64" {
arch = "x86_64"
}
return arch
return coreosarch.CurrentRpmArch()
}

// defaultWalkFunc walks over a directory and returns a channel of os.FileInfo
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package cosa
package builds

import (
"bytes"
Expand Down
2 changes: 1 addition & 1 deletion schema/cosa/builds_test.go → pkg/builds/builds_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package cosa
package builds

import (
"io/ioutil"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package cosa
package builds

// generated by 'make schema'
// source hash: 144450d458f89f637ca487d353af3dfd60096ddbf3179da8e2b42b2bd2d0a6eb
Expand Down
2 changes: 1 addition & 1 deletion schema/cosa/schema.go → pkg/builds/schema.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package cosa
package builds

import (
"encoding/json"
Expand Down
2 changes: 1 addition & 1 deletion schema/cosa/schema_doc.go → pkg/builds/schema_doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Source hash: 144450d458f89f637ca487d353af3dfd60096ddbf3179da8e2b42b2bd2d0a6eb
// DO NOT EDIT

package cosa
package builds

var generatedSchemaJSON = `{
"definitions": {
Expand Down
Loading