diff --git a/cmd/clean.go b/cmd/clean.go index 4ce324c7cf291d90c1b18bdea8ad72d025145519..7d5e7045d18e44547b4d19bfc8016357e57b905b 100644 --- a/cmd/clean.go +++ b/cmd/clean.go @@ -11,6 +11,7 @@ import ( func runClean(argv []string) error { const cleanUsage = `Usage: coreos-assembler clean --help coreos-assembler clean [--all] + Delete all build artifacts. Use --all to also clean the cache/ directory. ` @@ -33,7 +34,8 @@ Delete all build artifacts. Use --all to also clean the cache/ directory. if err != nil { return err } - if _, err := sh.PrepareBuild(); err != nil { + // XXX: why do we need to prepare_build here? + if _, err := sh.PrepareBuild(""); err != nil { return err } @@ -46,7 +48,9 @@ Delete all build artifacts. Use --all to also clean the cache/ directory. if priv { cmd = fmt.Sprintf("sudo %s", cmd) } - bashexec.Run("cleanup cache", cmd) + if err := bashexec.Run("cleanup cache", cmd); err != nil { + return err + } } else { fmt.Println("Note: retaining cache/") } diff --git a/internal/pkg/cosa/variant.go b/internal/pkg/cosa/variant.go new file mode 100644 index 0000000000000000000000000000000000000000..361d367a3f234bee4729ced6a8ef327696a9d437 --- /dev/null +++ b/internal/pkg/cosa/variant.go @@ -0,0 +1,31 @@ +package cosa + +import ( + "encoding/json" + "fmt" + "os" +) + +const initConfigPath = "src/config.json" + +type configVariant struct { + Variant string `json:"coreos-assembler.config-variant"` +} + +// GetVariant finds the configured variant, or "" if unset +func GetVariant() (string, error) { + contents, err := os.ReadFile(initConfigPath) + if err != nil { + if !os.IsNotExist(err) { + return "", err + } + return "", nil + } + + var variantData configVariant + if err := json.Unmarshal(contents, &variantData); err != nil { + return "", fmt.Errorf("parsing %s: %w", initConfigPath, err) + } + + return variantData.Variant, nil +} diff --git a/internal/pkg/cosash/cosash.go b/internal/pkg/cosash/cosash.go index abde61b59b23b9abccfbc6c4487254c23990c203..b270909b0ea8aa132e225e1062a6d121aa7796c6 100644 --- a/internal/pkg/cosash/cosash.go +++ b/internal/pkg/cosash/cosash.go @@ -159,7 +159,12 @@ func (sh *CosaSh) Process(buf string) error { } // PrepareBuild prepares for a build, returning the newly allocated build directory -func (sh *CosaSh) PrepareBuild() (string, error) { +func (sh *CosaSh) PrepareBuild(artifact_name string) (string, error) { + if artifact_name != "" { + if err := sh.Process(fmt.Sprintf("IMAGE_TYPE=%s", artifact_name)); err != nil { + return "", err + } + } return sh.ProcessWithReply(`prepare_build pwd >&3 `) diff --git a/schema/cosa/build.go b/pkg/builds/build.go similarity index 87% rename from schema/cosa/build.go rename to pkg/builds/build.go index 5e7cd1a8b6f4aa617a621e13cdc69645115d70fd..1bb8a52a2792692c5af17006bc51b004e24cd987 100644 --- a/schema/cosa/build.go +++ b/pkg/builds/build.go @@ -12,22 +12,21 @@ // See the License for the specific language governing permissions and // limitations under the License. -package cosa +package builds import ( "encoding/json" "fmt" "io" - "io/ioutil" "net/http" "os" "path/filepath" "reflect" "regexp" - "runtime" "sort" "strings" + coreosarch "github.com/coreos/stream-metadata-go/arch" "github.com/pkg/errors" log "github.com/sirupsen/logrus" ) @@ -51,6 +50,11 @@ const ( CosaMetaJSON = "meta.json" ) +type objectInfo struct { + info os.FileInfo + name string +} + // SetArch overrides the build arch func SetArch(a string) { forceArch = a @@ -62,11 +66,26 @@ 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 +func walkFn(p string) <-chan *objectInfo { + ret := make(chan *objectInfo) + go func() { + defer close(ret) //nolint + _ = filepath.Walk(p, func(path string, info os.FileInfo, err error) error { + if err != nil { + return nil + } + ret <- &objectInfo{ + name: filepath.Join(p, info.Name()), + info: info, + } + return nil + }) + }() + return ret } // ReadBuild returns a build upon finding a meta.json. Returns a Build, the path string @@ -93,7 +112,7 @@ func ReadBuild(dir, buildID, arch string) (*Build, string, error) { } p := filepath.Join(dir, buildID, arch) - f, err := Open(filepath.Join(p, CosaMetaJSON)) + f, err := os.Open(filepath.Join(p, CosaMetaJSON)) if err != nil { return nil, "", fmt.Errorf("failed to open %s to read meta.json: %w", p, err) } @@ -113,14 +132,14 @@ func ReadBuild(dir, buildID, arch string) (*Build, string, error) { if !ok { break } - if fi == nil || fi.IsDir() || fi.Name() == CosaMetaJSON { + if fi == nil || fi.info.IsDir() || fi.info.Name() == CosaMetaJSON { continue } - if !IsMetaJSON(fi.Name()) { + if !IsMetaJSON(fi.info.Name()) { continue } - log.WithField("extra meta.json", fi.Name()).Info("found meta") - f, err := Open(filepath.Join(p, fi.Name())) + log.WithField("extra meta.json", fi.name).Info("found meta") + f, err := os.Open(filepath.Join(p, fi.info.Name())) if err != nil { return b, p, err } @@ -146,7 +165,7 @@ func buildParser(r io.Reader) (*Build, error) { // ParseBuild parses the meta.json and reutrns a build func ParseBuild(path string) (*Build, error) { - f, err := Open(path) + f, err := os.Open(path) if err != nil { return nil, errors.Wrapf(err, "failed to open %s", path) } @@ -169,7 +188,7 @@ func (build *Build) WriteMeta(path string, validate bool) error { if err != nil { return err } - return ioutil.WriteFile(path, out, 0644) + return os.WriteFile(path, out, 0644) } // GetArtifact returns an artifact by JSON tag @@ -178,7 +197,7 @@ func (build *Build) GetArtifact(artifact string) (*Artifact, error) { if ok && r.Path != "" { return r, nil } - return nil, errors.New("artifact not defined") + return nil, errors.New("artifact " + artifact + " not defined") } // IsArtifact takes a path and returns the artifact type and a bool if @@ -305,6 +324,10 @@ func FetchAndParseBuild(url string) (*Build, error) { return nil, err } defer res.Body.Close() + if res.StatusCode != 200 { + return nil, fmt.Errorf( + "Received a %d error in http response for: %s", res.StatusCode, url) + } return buildParser(res.Body) } diff --git a/schema/cosa/builds.go b/pkg/builds/builds.go similarity index 96% rename from schema/cosa/builds.go rename to pkg/builds/builds.go index 31f50c5c682ed9e9e5287611306943dc0e1da52d..d0fcef1d1f2e65b21ce116dc49c1bb7e6959cc2e 100644 --- a/schema/cosa/builds.go +++ b/pkg/builds/builds.go @@ -1,9 +1,10 @@ -package cosa +package builds import ( "bytes" "encoding/json" "io" + "os" "path/filepath" "github.com/pkg/errors" @@ -35,7 +36,7 @@ type buildsJSON struct { func getBuilds(dir string) (*buildsJSON, error) { path := filepath.Join(dir, CosaBuildsJSON) - f, err := Open(path) + f, err := os.Open(path) if err != nil { return nil, ErrNoBuildsFound } diff --git a/schema/cosa/builds_test.go b/pkg/builds/builds_test.go similarity index 85% rename from schema/cosa/builds_test.go rename to pkg/builds/builds_test.go index 5ad2176fd4fd475a6f508c76fc2797c43f50fb67..edef3c8c3a2b44475724f42d0eed93c6893097ea 100644 --- a/schema/cosa/builds_test.go +++ b/pkg/builds/builds_test.go @@ -1,7 +1,6 @@ -package cosa +package builds import ( - "io/ioutil" "os" "path/filepath" "testing" @@ -23,12 +22,11 @@ var testData = ` ` func TestBuildsMeta(t *testing.T) { - tmpd, _ := ioutil.TempDir("", "buildjson") - defer os.RemoveAll(tmpd) + tmpd := t.TempDir() _ = os.MkdirAll(filepath.Join(tmpd, "builds"), 0755) bjson := filepath.Join(tmpd, CosaBuildsJSON) - if err := ioutil.WriteFile(bjson, []byte(testData), 0666); err != nil { + if err := os.WriteFile(bjson, []byte(testData), 0666); err != nil { t.Fatalf("failed to write the test data %v", err) } diff --git a/schema/cosa/cosa_v1.go b/pkg/builds/cosa_v1.go similarity index 63% rename from schema/cosa/cosa_v1.go rename to pkg/builds/cosa_v1.go index 1b9875a847d539aab4d647fbe79c6069f15290d0..31323c19482e79987c9570702702ae212693863f 100644 --- a/schema/cosa/cosa_v1.go +++ b/pkg/builds/cosa_v1.go @@ -1,6 +1,7 @@ -package cosa +package builds // generated by 'make schema' +// source hash: 73eba405214212d41c92204c48cde7bede443c9815395676b5e9c52531d08a61 type AdvisoryDiff []AdvisoryDiffItems @@ -33,13 +34,15 @@ type Build struct { Amis []Amis `json:"amis,omitempty"` Architecture string `json:"coreos-assembler.basearch,omitempty"` Azure *Cloudartifact `json:"azure,omitempty"` + BaseOsContainer *Image `json:"base-oscontainer,omitempty"` BuildArtifacts *BuildArtifacts `json:"images,omitempty"` BuildID string `json:"buildid"` BuildRef string `json:"ref,omitempty"` - BuildSummary string `json:"summary"` + BuildSummary string `json:"summary,omitempty"` BuildTimeStamp string `json:"coreos-assembler.build-timestamp,omitempty"` BuildURL string `json:"build-url,omitempty"` ConfigGitRev string `json:"coreos-assembler.config-gitrev,omitempty"` + ConfigVariant string `json:"coreos-assembler.config-variant,omitempty"` ContainerConfigGit *Git `json:"coreos-assembler.container-config-git,omitempty"` CoreOsSource string `json:"coreos-assembler.code-source,omitempty"` CosaContainerImageGit *Git `json:"coreos-assembler.container-image-git,omitempty"` @@ -47,14 +50,16 @@ type Build struct { CosaImageChecksum string `json:"coreos-assembler.image-config-checksum,omitempty"` CosaImageVersion int `json:"coreos-assembler.image-genver,omitempty"` Extensions *Extensions `json:"extensions,omitempty"` + ExtensionsContainer *Image `json:"extensions-container,omitempty"` FedoraCoreOsParentCommit string `json:"fedora-coreos.parent-commit,omitempty"` FedoraCoreOsParentVersion string `json:"fedora-coreos.parent-version,omitempty"` Gcp *Gcp `json:"gcp,omitempty"` GitDirty string `json:"coreos-assembler.config-dirty,omitempty"` IbmCloud []Cloudartifact `json:"ibmcloud,omitempty"` ImageInputChecksum string `json:"coreos-assembler.image-input-checksum,omitempty"` - InputHasOfTheRpmOstree string `json:"rpm-ostree-inputhash"` + InputHashOfTheRpmOstree string `json:"rpm-ostree-inputhash"` Koji *Koji `json:"koji,omitempty"` + KubevirtContainer *Image `json:"kubevirt,omitempty"` MetaStamp float64 `json:"coreos-assembler.meta-stamp,omitempty"` Name string `json:"name"` Oscontainer *Image `json:"oscontainer,omitempty"` @@ -73,34 +78,45 @@ type Build struct { PkgdiffBetweenBuilds PackageSetDifferences `json:"pkgdiff,omitempty"` PowerVirtualServer []Cloudartifact `json:"powervs,omitempty"` ReleasePayload *Image `json:"release-payload,omitempty"` + S3 *S3 `json:"s3,omitempty"` + YumReposGit *Git `json:"coreos-assembler.yumrepos-git,omitempty"` } type BuildArtifacts struct { - Aliyun *Artifact `json:"aliyun,omitempty"` - Aws *Artifact `json:"aws,omitempty"` - Azure *Artifact `json:"azure,omitempty"` - AzureStack *Artifact `json:"azurestack,omitempty"` - Dasd *Artifact `json:"dasd,omitempty"` - DigitalOcean *Artifact `json:"digitalocean,omitempty"` - Exoscale *Artifact `json:"exoscale,omitempty"` - Gcp *Artifact `json:"gcp,omitempty"` - IbmCloud *Artifact `json:"ibmcloud,omitempty"` - Initramfs *Artifact `json:"initramfs,omitempty"` - Iso *Artifact `json:"iso,omitempty"` - Kernel *Artifact `json:"kernel,omitempty"` - LiveInitramfs *Artifact `json:"live-initramfs,omitempty"` - LiveIso *Artifact `json:"live-iso,omitempty"` - LiveKernel *Artifact `json:"live-kernel,omitempty"` - LiveRootfs *Artifact `json:"live-rootfs,omitempty"` - Metal *Artifact `json:"metal,omitempty"` - Metal4KNative *Artifact `json:"metal4k,omitempty"` - Nutanix *Artifact `json:"nutanix,omitempty"` - OpenStack *Artifact `json:"openstack,omitempty"` - Ostree Artifact `json:"ostree"` - PowerVirtualServer *Artifact `json:"powervs,omitempty"` - Qemu *Artifact `json:"qemu,omitempty"` - Vmware *Artifact `json:"vmware,omitempty"` - Vultr *Artifact `json:"vultr,omitempty"` + Aliyun *Artifact `json:"aliyun,omitempty"` + AppleHv *Artifact `json:"applehv,omitempty"` + Aws *Artifact `json:"aws,omitempty"` + Azure *Artifact `json:"azure,omitempty"` + AzureStack *Artifact `json:"azurestack,omitempty"` + Dasd *Artifact `json:"dasd,omitempty"` + DigitalOcean *Artifact `json:"digitalocean,omitempty"` + Exoscale *Artifact `json:"exoscale,omitempty"` + ExtensionsContainer *Artifact `json:"extensions-container,omitempty"` + Gcp *Artifact `json:"gcp,omitempty"` + HyperV *Artifact `json:"hyperv,omitempty"` + IbmCloud *Artifact `json:"ibmcloud,omitempty"` + Initramfs *Artifact `json:"initramfs,omitempty"` + Iso *Artifact `json:"iso,omitempty"` + Kernel *Artifact `json:"kernel,omitempty"` + KubeVirt *Artifact `json:"kubevirt,omitempty"` + LegacyOscontainer *Artifact `json:"legacy-oscontainer,omitempty"` + LiveInitramfs *Artifact `json:"live-initramfs,omitempty"` + LiveIso *Artifact `json:"live-iso,omitempty"` + LiveKernel *Artifact `json:"live-kernel,omitempty"` + LiveRootfs *Artifact `json:"live-rootfs,omitempty"` + Metal *Artifact `json:"metal,omitempty"` + Metal4KNative *Artifact `json:"metal4k,omitempty"` + Nutanix *Artifact `json:"nutanix,omitempty"` + OciManifest *Artifact `json:"oci-manifest,omitempty"` + OpenStack *Artifact `json:"openstack,omitempty"` + Ostree Artifact `json:"ostree"` + PowerVirtualServer *Artifact `json:"powervs,omitempty"` + Qemu *Artifact `json:"qemu,omitempty"` + SecureExecutionIgnitionPubKey *Artifact `json:"ignition-gpg-key,omitempty"` + SecureExecutionQemu *Artifact `json:"qemu-secex,omitempty"` + VirtualBox *Artifact `json:"virtualbox,omitempty"` + Vmware *Artifact `json:"vmware,omitempty"` + Vultr *Artifact `json:"vultr,omitempty"` } type Cloudartifact struct { @@ -134,8 +150,9 @@ type Git struct { type Image struct { Comment string `json:"comment,omitempty"` - Digest string `json:"digest"` + Digest string `json:"digest,omitempty"` Image string `json:"image"` + Tags []Tag `json:"tags,omitempty"` } type Koji struct { @@ -147,3 +164,11 @@ type Koji struct { type PackageSetDifferences []PackageSetDifferencesItems type PackageSetDifferencesItems interface{} + +type S3 struct { + Bucket string `json:"bucket,omitempty"` + Key string `json:"key,omitempty"` + PublicURL string `json:"public-url,omitempty"` +} + +type Tag string diff --git a/schema/cosa/schema.go b/pkg/builds/schema.go similarity index 96% rename from schema/cosa/schema.go rename to pkg/builds/schema.go index c712e678955df3cd7a1354b9ee2eefcb3f11fedc..2c1e26d1f80ca0d986ec581a1888ea704e03e43b 100644 --- a/schema/cosa/schema.go +++ b/pkg/builds/schema.go @@ -1,10 +1,9 @@ -package cosa +package builds import ( "encoding/json" "fmt" "io" - "io/ioutil" "os" "strings" @@ -41,7 +40,7 @@ func SetSchemaFromFile(r io.Reader) error { if r == nil { return errors.New("schema input is invalid") } - in, err := ioutil.ReadAll(r) + in, err := io.ReadAll(r) if err != nil { return err } diff --git a/pkg/builds/schema_doc.go b/pkg/builds/schema_doc.go new file mode 100644 index 0000000000000000000000000000000000000000..273a10f3e995cb154291a0830308a4410d681906 --- /dev/null +++ b/pkg/builds/schema_doc.go @@ -0,0 +1,999 @@ +// Generated by ./generate-schema.sh +// Source hash: 73eba405214212d41c92204c48cde7bede443c9815395676b5e9c52531d08a61 +// DO NOT EDIT + +package builds + +var generatedSchemaJSON = `{ + "definitions": { + "artifact": { + "type": "object", + "properties": { + "path": { + "$id": "#/artifact/Path", + "type": "string", + "title": "Path" + }, + "sha256": { + "$id": "#/artifact/sha256", + "type": "string", + "title": "SHA256" + }, + "size": { + "$id": "#/artifact/size", + "type": "number", + "title": "Size in bytes" + }, + "skip-compression": { + "$id": "#/artifact/skip-compression", + "type": "boolean", + "title": "Skip compression", + "description": "Artifact should not be compressed or decompressed before use", + "default": false + }, + "uncompressed-sha256": { + "$id": "#/artifact/uncompressed-sha256", + "type": "string", + "title": "Uncompressed SHA256" + }, + "uncompressed-size": { + "$id": "#/artifact/uncompressed-size", + "type": "integer", + "title": "Uncompressed-size" + } + }, + "optional": [ + "size", + "uncompressed-sha256", + "uncompressed-size", + "skip-compression" + ], + "required": [ + "path", + "sha256" + ] + }, + "image": { + "type": "object", + "required": [ + "image" + ], + "optional": [ + "digest", + "tags", + "comment" + ], + "properties": { + "digest": { + "$id": "#/image/digest", + "type": "string", + "title": "Digest" + }, + "comment": { + "$id": "#/image/comment", + "type": "string", + "title": "Comment" + }, + "image": { + "$id": "#/image/image", + "type": "string", + "title": "Image" + }, + "tags": { + "$id": "#/image/tags", + "type": "array", + "title": "Tags", + "items": { + "$id": "#/image/tags/item", + "title": "Tag", + "type": "string" + } + } + } + }, + "cloudartifact": { + "type": "object", + "required": [ + "url" + ], + "optional": [ + "image", + "object", + "bucket", + "region" + ], + "properties": { + "image": { + "$id": "#/cloudartifact/image", + "type": "string", + "title": "Image" + }, + "url": { + "$id": "#/cloudartifact/url", + "type": "string", + "title": "URL" + }, + "bucket": { + "$id": "#/cloudartifact/bucket", + "type": "string", + "title": "Bucket" + }, + "region": { + "$id": "#/cloudartifact/region", + "type": "string", + "title": "Region" + }, + "object": { + "$id": "#/cloudartifact/object", + "type": "string", + "title": "Object" + } + } + }, + "git": { + "type": "object", + "required": [ + "commit", + "origin" + ], + "optional": [ + "branch", + "dirty" + ], + "properties": { + "branch": { + "$id": "#/git/branch", + "type": "string", + "title": "branch", + "default": "", + "examples": [ + "HEAD" + ], + "minLength": 3 + }, + "commit": { + "$id": "#/git/commit", + "type": "string", + "title": "commit", + "default": "", + "examples": [ + "742edc307e58f35824d906958b6493510e12b593" + ], + "minLength": 5 + }, + "dirty": { + "$id": "#/git/dirty", + "type": "string", + "title": "dirty", + "default": "", + "examples": [ + "true" + ], + "minLength": 1 + }, + "origin": { + "$id": "#/git/origin", + "type": "string", + "title": "origin", + "default": "", + "examples": [ + "https://github.com/coreos/fedora-coreos-config" + ], + "minLength": 1 + } + } + }, + "pkg-items": { + "type": "array", + "title": "Package Set differences", + "items": { + "$id": "#/pkgdiff/items/item", + "title": "Items", + "default": "", + "minLength": 1 + } + }, + "advisory-items": { + "type": "array", + "title": "Advisory diff", + "items": { + "$id": "#/advisory-diff/items/item", + "title": "Items", + "default": "" + } + } + }, + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "http://github.com/coreos/coreos-assembler/blob/main/v1.json.json", + "type": "object", + "title": "CoreOS Assember v1 meta.json schema", + "required": [ + "buildid", + "name", + "ostree-commit", + "ostree-content-checksum", + "ostree-timestamp", + "ostree-version", + "rpm-ostree-inputhash" + ], + "optional": [ + "aliyun", + "amis", + "azure", + "azurestack", + "base-oscontainer", + "build-url", + "digitalocean", + "exoscale", + "gcp", + "kubevirt", + "ibmcloud", + "powervs", + "images", + "koji", + "oscontainer", + "extensions", + "extensions-container", + "parent-pkgdiff", + "pkgdiff", + "parent-advisories-diff", + "advisories-diff", + "release-payload", + "summary", + "s3", + "coreos-assembler.basearch", + "coreos-assembler.build-timestamp", + "coreos-assembler.code-source", + "coreos-assembler.config-dirty", + "coreos-assembler.config-gitrev", + "coreos-assembler.config-variant", + "coreos-assembler.container-config-git", + "coreos-assembler.container-image-git", + "coreos-assembler.delayed-meta-merge", + "coreos-assembler.image-config-checksum", + "coreos-assembler.image-genver", + "coreos-assembler.image-input-checksum", + "coreos-assembler.meta-stamp", + "coreos-assembler.overrides-active", + "coreos-assembler.yumrepos-git", + "fedora-coreos.parent-commit", + "fedora-coreos.parent-version", + "ref" + ], + "additionalProperties": false, + "properties": { + "ref": { + "$id": "#/properties/ref", + "type": "string", + "title": "BuildRef", + "default": "", + "minLength": 1 + }, + "build-url": { + "$id": "#/properties/build-url", + "type": "string", + "title": "Build URL", + "default": "", + "minLength": 1 + }, + "buildid": { + "$id": "#/properties/buildid", + "type": "string", + "title": "BuildID", + "default": "", + "minLength": 1 + }, + "s3": { + "type": "object", + "properties": { + "bucket": { + "$id": "#/properties/bucket", + "type": "string", + "title": "Bucket" + }, + "key": { + "$id": "#/properties/key", + "type": "string", + "title": "Key" + }, + "public-url": { + "$id": "#/properties/public-url", + "type": "string", + "title": "Public URL" + } + } + }, + "koji": { + "type": "object", + "properties": { + "build_id": { + "$id": "#/properties/kojiid", + "type": "number", + "title": "Koji Build ID" + }, + "token": { + "$id": "#/properties/kojitoken", + "type": "string", + "title": "Koji Token" + }, + "release": { + "$id": "#/properties/buildrelease", + "type": "string", + "title": "Build Release" + } + } + }, + "coreos-assembler.basearch": { + "$id": "#/properties/coreos-assembler.basearch", + "type": "string", + "title": "Architecture", + "default": "", + "minLength": 1 + }, + "coreos-assembler.build-timestamp": { + "$id": "#/properties/coreos-assembler.build-timestamp", + "type": "string", + "title": "Build Time Stamp", + "default": "", + "minLength": 1 + }, + "coreos-assembler.code-source": { + "$id": "#/properties/coreos-assembler.code-source", + "type": "string", + "title": "CoreOS Source", + "default": "", + "minLength": 1 + }, + "coreos-assembler.config-dirty": { + "$id": "#/properties/coreos-assembler.config-dirty", + "type": "string", + "title": "GitDirty", + "default": "", + "minLength": 1 + }, + "coreos-assembler.config-gitrev": { + "$id": "#/properties/coreos-assembler.config-gitrev", + "type": "string", + "title": "Config GitRev", + "default": "", + "minLength": 1 + }, + "coreos-assembler.config-variant": { + "$id": "#/properties/coreos-assembler.config-variant", + "type": "string", + "title": "Config variant", + "default": "" + }, + "coreos-assembler.container-config-git": { + "$id": "#/properties/coreos-assembler.container-config-git", + "type": "object", + "title": "Container Config Git", + "$ref": "#/definitions/git" + }, + "coreos-assembler.container-image-git": { + "$id": "#/properties/coreos-assembler.container-image-git", + "type": "object", + "title": "COSA Container Image Git", + "$ref": "#/definitions/git" + }, + "coreos-assembler.delayed-meta-merge": { + "$id": "#/properties/coreos-assembler.delayed-meta-merge", + "type": "boolean", + "title": "COSA Delayed Meta Merge", + "default": "False" + }, + "coreos-assembler.yumrepos-git": { + "$id": "#/properties/coreos-assembler.yumrepos-git", + "type": "object", + "title": "YUM repos Git", + "$ref": "#/definitions/git" + }, + "coreos-assembler.meta-stamp": { + "$id": "#/properties/coreos-assembler.meta-stamp", + "type": "number", + "title": "Meta Stamp", + "default": "", + "minLength": 16 + }, + "fedora-coreos.parent-version": { + "$id": "#/properties/fedora-coreos.parent-version", + "type": "string", + "title": "Fedora CoreOS Parent Version", + "default": "", + "minLength": 12 + }, + "fedora-coreos.parent-commit": { + "$id": "#/properties/fedora-coreos.parent-commit", + "type": "string", + "title": "Fedora CoreOS parent commit", + "default": "", + "examples": [ + "f15f5b25cf138a7683e3d200c53ece2091bf71d31332135da87892ab72ff4ee3" + ], + "minLength": 64 + }, + "coreos-assembler.image-config-checksum": { + "$id": "#/properties/coreos-assembler.image-config-checksum", + "type": "string", + "title": "COSA image checksum", + "default": "", + "minLength": 64 + }, + "coreos-assembler.image-genver": { + "$id": "#/properties/coreos-assembler.image-genver", + "type": "integer", + "title": "COSA Image Version", + "default": 0, + "examples": [ + 0 + ] + }, + "coreos-assembler.image-input-checksum": { + "$id": "#/properties/coreos-assembler.image-input-checksum", + "type": "string", + "title": "Image input checksum", + "default": "", + "minLength": 64 + }, + "coreos-assembler.overrides-active": { + "$id": "#/properties/coreos-assembler.overrides-active", + "title": "Overrides Active", + "default": "", + "type": "boolean" + }, + "images": { + "$id": "#/properties/images", + "type": "object", + "title": "Build Artifacts", + "required": [ + "ostree" + ], + "optional": [ + "applehv", + "aliyun", + "aws", + "azure", + "azurestack", + "dasd", + "digitalocean", + "exoscale", + "extensions-container", + "legacy-oscontainer", + "gcp", + "kubevirt", + "hyperv", + "ibmcloud", + "powervs", + "initramfs", + "iso", + "kernel", + "live-kernel", + "live-initramfs", + "live-iso", + "live-rootfs", + "metal", + "metal4k", + "nutanix", + "openstack", + "qemu", + "virtualbox", + "vmware", + "vultr", + "qemu-secex", + "ignition-gpg-key", + "oci-manifest" + ], + "properties": { + "ostree": { + "$id": "#/properties/images/properties/ostree", + "type": "object", + "title": "OSTree", + "$ref": "#/definitions/artifact" + }, + "oci-manifest": { + "$id": "#/properties/images/properties/oci-manifest", + "type": "object", + "title": "OCI Manifest", + "$ref": "#/definitions/artifact" + }, + "dasd": { + "$id": "#/properties/images/properties/dasd", + "type": "object", + "title": "dasd", + "$ref": "#/definitions/artifact" + }, + "exoscale": { + "$id": "#/properties/images/properties/exoscale", + "type": "object", + "title": "exoscale", + "$ref": "#/definitions/artifact" + }, + "extensions-container": { + "$id": "#/properties/images/properties/extensions-container", + "type": "object", + "title": "extensions-container", + "$ref": "#/definitions/artifact" + }, + "legacy-oscontainer": { + "$id": "#/properties/images/properties/legacy-oscontainer", + "type": "object", + "title": "legacy-oscontainer", + "$ref": "#/definitions/artifact" + }, + "qemu": { + "$id": "#/properties/images/properties/qemu", + "type": "object", + "title": "Qemu", + "$ref": "#/definitions/artifact" + }, + "qemu-secex": { + "$id": "#/properties/images/properties/secex", + "type": "object", + "title": "Secure Execution Qemu", + "$ref": "#/definitions/artifact" + }, + "ignition-gpg-key": { + "$id": "#/properties/images/properties/ignition-gpg-key", + "type": "object", + "title": "Secure Execution Ignition PubKey", + "$ref": "#/definitions/artifact" + }, + "metal": { + "$id": "#/properties/images/properties/metal", + "type": "object", + "title": "Metal", + "$ref": "#/definitions/artifact" + }, + "metal4k": { + "$id": "#/properties/images/properties/metal4k", + "type": "object", + "title": "Metal (4K native)", + "$ref": "#/definitions/artifact" + }, + "iso": { + "$id": "#/properties/images/properties/iso", + "type": "object", + "title": "ISO", + "$ref": "#/definitions/artifact" + }, + "kernel": { + "$id": "#/properties/images/properties/kernel", + "type": "object", + "title": "Kernel", + "$ref": "#/definitions/artifact" + }, + "initramfs": { + "$id": "#/properties/images/properties/initramfs", + "type": "object", + "title": "Initramfs", + "$ref": "#/definitions/artifact" + }, + "live-kernel": { + "$id": "#/properties/images/properties/live-kernel", + "type": "object", + "title": "Live Kernel", + "$ref": "#/definitions/artifact" + }, + "live-initramfs": { + "$id": "#/properties/images/properties/live-initramfs", + "type": "object", + "title": "Live Initramfs", + "$ref": "#/definitions/artifact" + }, + "live-iso": { + "$id": "#/properties/images/properties/live-iso", + "type": "object", + "title": "Live ISO", + "$ref": "#/definitions/artifact" + }, + "live-rootfs": { + "$id": "#/properties/images/properties/live-rootfs", + "type": "object", + "title": "Live Rootfs", + "$ref": "#/definitions/artifact" + }, + "nutanix": { + "$id": "#/properties/images/properties/nutanix", + "type": "object", + "title": "Nutanix", + "$ref": "#/definitions/artifact" + }, + "openstack": { + "$id": "#/properties/images/properties/openstack", + "type": "object", + "title": "OpenStack", + "$ref": "#/definitions/artifact" + }, + "virtualbox": { + "$id": "#/properties/images/properties/virtualbox", + "type": "object", + "title": "VirtualBox", + "$ref": "#/definitions/artifact" + }, + "vmware": { + "$id": "#/properties/images/properties/vmware", + "type": "object", + "title": "VMWare", + "$ref": "#/definitions/artifact" + }, + "vultr": { + "$id": "#/properties/images/properties/vultr", + "type": "object", + "title": "Vultr", + "$ref": "#/definitions/artifact" + }, + "applehv": { + "$id": "#/properties/images/properties/applehv", + "type": "object", + "title": "AppleHV", + "$ref": "#/definitions/artifact" + }, + "aliyun": { + "$id": "#/properties/images/properties/aliyun", + "type": "object", + "title": "Aliyun", + "$ref": "#/definitions/artifact" + }, + "aws": { + "$id": "#/properties/images/properties/aws", + "type": "object", + "title": "AWS", + "$ref": "#/definitions/artifact" + }, + "azure": { + "$id": "#/properties/images/properties/azure", + "type": "object", + "title": "Azure", + "$ref": "#/definitions/artifact" + }, + "azurestack": { + "$id": "#/properties/images/properties/azurestack", + "type": "object", + "title": "AzureStack", + "$ref": "#/definitions/artifact" + }, + "digitalocean": { + "$id": "#/properties/images/properties/digitalocean", + "type": "object", + "title": "DigitalOcean", + "$ref": "#/definitions/artifact" + }, + "ibmcloud": { + "$id": "#/properties/images/properties/ibmcloud", + "type": "object", + "title": "IBM Cloud", + "$ref": "#/definitions/artifact" + }, + "powervs": { + "$id": "#/properties/images/properties/powervs", + "type": "object", + "title": "Power Virtual Server", + "$ref": "#/definitions/artifact" + }, + "gcp": { + "$id": "#/properties/images/properties/gcp", + "type": "object", + "title": "GCP", + "$ref": "#/definitions/artifact" + }, + "kubevirt": { + "$id": "#/properties/images/properties/kubevirt", + "type": "object", + "title": "KubeVirt", + "$ref": "#/definitions/artifact" + }, + "hyperv": { + "$id": "#/properties/images/properties/hyperv", + "type": "object", + "title": "HyperV", + "$ref": "#/definitions/artifact" + } + } + }, + "name": { + "$id": "#/properties/name", + "type": "string", + "title": "Name", + "default": "fedora-coreos", + "examples": [ + "rhcos", + "fedora-coreos" + ] + }, + "oscontainer": { + "$id": "#/properties/oscontainer", + "type": "object", + "title": "Oscontainer", + "$ref": "#/definitions/image" + }, + "extensions": { + "$id": "#/properties/extensions", + "type": "object", + "title": "Extensions", + "required": [ + "path", + "sha256", + "rpm-ostree-state", + "manifest" + ], + "properties": { + "path": { + "$id": "#/artifact/Path", + "type": "string", + "title": "Path" + }, + "sha256": { + "$id": "#/artifact/sha256", + "type": "string", + "title": "SHA256" + }, + "rpm-ostree-state": { + "$id": "#/properties/extensions/items/properties/rpm-ostree-state", + "type": "string", + "title": "RpmOstreeState", + "default": "", + "minLength": 64 + }, + "manifest": { + "$id": "#/properties/extensions/items/properties/manifest", + "type": "object", + "title": "Manifest" + } + } + }, + "ostree-commit": { + "$id": "#/properties/ostree-commit", + "type": "string", + "title": "ostree-commit", + "default": "", + "minLength": 64 + }, + "ostree-content-bytes-written": { + "$id": "#/properties/ostree-content-bytes-written", + "type": "integer", + "title": "ostree-content-bytes-written", + "default": 0 + }, + "ostree-content-checksum": { + "$id": "#/properties/ostree-content-checksum", + "type": "string", + "title": "ostree-content-checksum", + "default": "", + "minLength": 64 + }, + "ostree-n-cache-hits": { + "$id": "#/properties/ostree-n-cache-hits", + "type": "integer", + "title": "ostree-n-cache-hits", + "default": 0 + }, + "ostree-n-content-total": { + "$id": "#/properties/ostree-n-content-total", + "type": "integer", + "title": "ostree-n-content-total", + "default": 0 + }, + "ostree-n-content-written": { + "$id": "#/properties/ostree-n-content-written", + "type": "integer", + "title": "ostree-n-content-written", + "default": 0 + }, + "ostree-n-metadata-total": { + "$id": "#/properties/ostree-n-metadata-total", + "type": "integer", + "title": "ostree-n-metadata-total", + "default": 0 + }, + "ostree-n-metadata-written": { + "$id": "#/properties/ostree-n-metadata-written", + "type": "integer", + "title": "ostree-n-metadata-written", + "default": 0 + }, + "ostree-timestamp": { + "$id": "#/properties/ostree-timestamp", + "type": "string", + "title": "ostree timestamp", + "default": "", + "examples": [ + "2020-01-15T19:31:31Z" + ], + "pattern": "\\d{4}-\\d{2}-\\d{2}T.*Z$" + }, + "ostree-version": { + "$id": "#/properties/ostree-version", + "type": "string", + "title": "ostree version", + "default": "", + "minLength": 1 + }, + "pkgdiff": { + "$id": "#/properties/pkgdiff", + "type": "array", + "title": "pkgdiff between builds", + "$ref": "#/definitions/pkg-items" + }, + "parent-pkgdiff": { + "$id": "#/properties/parent-pkgdiff", + "type": "array", + "title": "pkgdiff against parent", + "$ref": "#/definitions/pkg-items" + }, + "advisories-diff": { + "$id": "#/properties/advisories-diff", + "type": "array", + "title": "advisory diff between builds", + "$ref": "#/definitions/advisory-items" + }, + "parent-advisories-diff": { + "$id": "#/properties/parent-advisory-diff", + "type": "array", + "title": "advisory diff against parent", + "$ref": "#/definitions/advisory-items" + }, + "rpm-ostree-inputhash": { + "$id": "#/properties/rpm-ostree-inputhash", + "type": "string", + "title": "input hash of the rpm-ostree", + "default": "", + "minLength": 64 + }, + "summary": { + "$id": "#/properties/summary", + "type": "string", + "title": "Build Summary", + "default": "", + "minLength": 1 + }, + "aliyun": { + "$id": "#/properties/aliyun", + "type": "array", + "title": "Alibaba/Aliyun Uploads", + "items": { + "$id": "#/properties/aliyun/images", + "type": "object", + "title": "Aliyun Image", + "required": [ + "name", + "id" + ], + "properties": { + "name": { + "$id": "#/properties/aliyun/items/properties/name", + "type": "string", + "title": "Region", + "default": "", + "minLength": 1 + }, + "id": { + "$id": "#/properties/aliyun/items/properties/id", + "type": "string", + "title": "ImageID", + "default": "", + "minLength": 1 + } + } + } + }, + "amis": { + "$id": "#/properties/amis", + "type": "array", + "title": "AMIS", + "items": { + "$id": "#/properties/amis/items", + "type": "object", + "title": "AMIS", + "required": [ + "name", + "hvm", + "snapshot" + ], + "properties": { + "name": { + "$id": "#/properties/amis/items/properties/name", + "type": "string", + "title": "Region", + "default": "" + }, + "hvm": { + "$id": "#/properties/amis/items/properties/hvm", + "type": "string", + "title": "HVM", + "default": "" + }, + "snapshot": { + "$id": "#/properties/amis/items/properties/snapshot", + "type": "string", + "title": "Snapshot", + "default": "" + } + } + } + }, + "azure": { + "$id": "#/properties/azure", + "type": "object", + "title": "Azure", + "$ref": "#/definitions/cloudartifact" + }, + "base-oscontainer": { + "$id": "#/properties/base-oscontainer", + "type": "object", + "title": "Base OS container", + "$ref": "#/definitions/image" + }, + "extensions-container": { + "$id": "#/properties/extensions-container", + "type": "object", + "title": "Extensions container", + "$ref": "#/definitions/image" + }, + "gcp": { + "$id": "#/properties/gcp", + "type": "object", + "title": "GCP", + "required": [ + "image", + "url" + ], + "optional": [ + "family", + "project" + ], + "properties": { + "image": { + "$id": "#/properties/gcp/image", + "type": "string", + "title": "Image Name" + }, + "url": { + "$id": "#/properties/gcp/url", + "type": "string", + "title": "URL" + }, + "project": { + "$id": "#/properties/gcp/project", + "type": "string", + "title": "Image Project" + }, + "family": { + "$id": "#/properties/gcp/family", + "type": "string", + "title": "Image Family" + } + } + }, + "kubevirt": { + "$id": "#/properties/kubevirt", + "type": "object", + "title": "Kubevirt container", + "$ref": "#/definitions/image" + }, + "ibmcloud": { + "$id": "#/properties/ibmcloud", + "type": "array", + "title": "IBM Cloud", + "items": { + "type": "object", + "$ref": "#/definitions/cloudartifact" + } + }, + "powervs": { + "$id": "#/properties/powervs", + "type": "array", + "title": "Power Virtual Server", + "items": { + "type": "object", + "$ref": "#/definitions/cloudartifact" + } + }, + "release-payload": { + "$id": "#/properties/release-payload", + "type": "object", + "title": "ReleasePayload", + "$ref": "#/definitions/image" + } + } +} +` diff --git a/schema/cosa/schema_test.go b/pkg/builds/schema_test.go similarity index 93% rename from schema/cosa/schema_test.go rename to pkg/builds/schema_test.go index 970af5d0688bfa92dc978371e7842b0d36ac804e..bacdd4c2a4441d0aa976b500a35a8738e3882228 100644 --- a/schema/cosa/schema_test.go +++ b/pkg/builds/schema_test.go @@ -1,11 +1,10 @@ -package cosa +package builds import ( "bytes" "encoding/json" "fmt" "io" - "io/ioutil" "net/http" "net/http/httptest" "os" @@ -43,11 +42,7 @@ func TestSchema(t *testing.T) { // Test that we can write a file func TestWriteMeta(t *testing.T) { - tmpd, err := ioutil.TempDir("", "test-writemeta-*****") - if err != nil { - t.Errorf("failed to create tmpdir: %v", err) - } - defer os.RemoveAll(tmpd) + tmpd := t.TempDir() for _, df := range testMeta { b, err := ParseBuild(df) @@ -152,11 +147,7 @@ func TestMergeMeta(t *testing.T) { b.CosaDelayedMetaMerge = true // Create a fake build structure - tmpd, err := ioutil.TempDir("", "") - if err != nil { - t.Fatal("unable to create a tmpdir") - } - defer os.RemoveAll(tmpd) //nolint + tmpd := t.TempDir() // Create a fake build dir fakeBuildID := "999.1" @@ -175,7 +166,7 @@ func TestMergeMeta(t *testing.T) { if err := os.MkdirAll(fakeBuildDir, 0777); err != nil { t.Fatalf("failed to create test meta structure") } - if err := ioutil.WriteFile(filepath.Join(tmpd, "builds", "builds.json"), bjson, 0644); err != nil { + if err := os.WriteFile(filepath.Join(tmpd, "builds", "builds.json"), bjson, 0644); err != nil { t.Fatalf("error creating builds.json") } if err := b.WriteMeta(filepath.Join(fakeBuildDir, "meta.json"), false); err != nil { diff --git a/schema/cosa/cosa_reader.go b/schema/cosa/cosa_reader.go deleted file mode 100644 index e193360a58305c322acda2f9f9e2c55ab2fd2dc2..0000000000000000000000000000000000000000 --- a/schema/cosa/cosa_reader.go +++ /dev/null @@ -1,252 +0,0 @@ -package cosa - -import ( - "context" - "io" - "os" - "path/filepath" - "strings" - "time" - - "github.com/minio/minio-go/v7" - "github.com/pkg/errors" - log "github.com/sirupsen/logrus" -) - -/* - cosa_reader.go provides an interface for interacting with - files through an "ioBackender." Any struct that inmplements ioBackender - can read meta-data. - -*/ - -// default ioBackend is file backend -var ioBackend ioBackender = new(ioBackendFile) - -// ioBackendMinio is an ioBackender. -var _ ioBackender = &ioBackendMinio{} - -// newBackend returns a new backend -func newBackend() ioBackender { - var newBackender ioBackender = ioBackend - return newBackender -} - -// Open calls the backend's open function. -func Open(p string) (io.ReadCloser, error) { - nb := newBackend() - return nb.Open(p) -} - -// ioBackender is the basic interface. -type ioBackender interface { - Open(string) (io.ReadCloser, error) -} - -// ioBackendFile is a file based backend -type ioBackendFile struct { - *os.File - path string -} - -// Open implements ioBackender Open interface. -func (i *ioBackendFile) Open(p string) (io.ReadCloser, error) { - f, err := os.Open(p) - i.File = f - i.path = p - return f, err -} - -func (i *ioBackendFile) Name() string { - return i.path -} - -// ioBackendMinio is a minio based backend -type ioBackendMinio struct { - ctx context.Context - m *minio.Client - obj *minio.Object - name string - - bucket string - prefix string -} - -var ErrNoMinioClient = errors.New("minio client is not defined") - -// getBucketAndPath returns the relative bucket and path. -func (im *ioBackendMinio) getBucketAndPath(p string) (string, string) { - parts := strings.Split(p, "/") - path := strings.Join(parts[1:], "/") - - bucket := parts[0] - if im.bucket != "" { - bucket = im.bucket - path = p - } - if im.prefix != "" { - path = filepath.Join(im.prefix, path) - } - return bucket, path -} - -// Open implements ioBackender's and os.File's Open interface. -func (im *ioBackendMinio) Open(p string) (io.ReadCloser, error) { - if im.m == nil { - return nil, ErrNoMinioClient - } - - bucket, path := im.getBucketAndPath(p) - obj, err := im.m.GetObject(im.ctx, bucket, path, minio.GetObjectOptions{}) - if err != nil { - return nil, err - } - im.obj = obj - im.name = p - - return obj, nil -} - -// objectInfo holds basic information about either a file object -// or a remote minio object. -type objectInfo struct { - info minio.ObjectInfo - name string -} - -// TODO: drop with GoLang 1.16. This is a backport of the interface from 1.16. -// var _ os.FileInfo = &objectInfo{} -type fileMode uint32 -type fileInfo interface { - Name() string // base name of the file - Size() int64 // length in bytes for regular files; system-dependent for others - Mode() fileMode // file mode bits - ModTime() time.Time // modification time - IsDir() bool // abbreviation for Mode().IsDir() - Sys() interface{} // underlying data source (can return nil) -} - -// objectInfo implements the os.FileInfo interface. -// This allows for abstracting any file or object to be compared as if they were -// local files regardless of location. -var _ fileInfo = &objectInfo{} - -// IsDir implements the os.FileInfo IsDir func. For minio objects, -// the answer is always false. -func (ao *objectInfo) IsDir() bool { - return false -} - -// ModTime implements the os.FileInfo ModTime func. The returned value -// is remote aodification time. -func (ao *objectInfo) ModTime() time.Time { - return ao.info.LastModified -} - -// Mode implements the os.FileInfo Mode func. Since there is not simple -// way to convert an ACL into Unix permisions, it blindly returns 0644. -func (ao *objectInfo) Mode() fileMode { - return 0644 -} - -// Name implements the os.FileInfo interface Name func. -func (ao *objectInfo) Name() string { - return filepath.Base(ao.name) -} - -// Size implements the os.FileInfo size func. -func (ao *objectInfo) Size() int64 { - return ao.info.Size -} - -// Sys implements the os.FileInfo interface Sys func. The interface spec allows -// for returning a nil. -func (ao *objectInfo) Sys() interface{} { - return nil -} - -// SetIOBackendMinio sets the backend to minio. The client must be provided -// by the caller, including authorization. -func SetIOBackendMinio(ctx context.Context, m *minio.Client, bucket, prefix string) error { - if m == nil { - return errors.New("minio client must not be nil") - } - - log.WithFields(log.Fields{ - "bucket": bucket, - "prefix": prefix, - }).Info("minio bucket and prefix defined") - - backend := &ioBackendMinio{ - m: m, - ctx: ctx, - bucket: bucket, - prefix: prefix, - } - ioBackend = backend - walkFn = createMinioWalkFunc(m, bucket, prefix) - return nil -} - -// SetIOBackendFile sets the backend to the default file backend. -func SetIOBackendFile() { - ioBackend = new(ioBackendFile) -} - -// walkerFn is a function that implements the walk func -type walkerFn func(string) <-chan fileInfo - -// walkFn is used to walk paths -var walkFn walkerFn = defaultWalkFunc - -// defaultWalkFunc walks over a directory and returns a channel of os.FileInfo -func defaultWalkFunc(p string) <-chan fileInfo { - ret := make(chan fileInfo) - go func() { - defer close(ret) //nolint - _ = filepath.Walk(p, func(path string, info os.FileInfo, err error) error { - if err != nil { - return nil - } - ret <- &objectInfo{ - name: filepath.Join(p, info.Name()), - info: minio.ObjectInfo{ - Key: info.Name(), - Size: info.Size(), - LastModified: info.ModTime(), - }, - } - return nil - }) - }() - return ret -} - -// createMinioWalkFunc creates a new func a minio client. The returned function -// will list the remote objects and return os.FileInfo compliant interfaces. -func createMinioWalkFunc(m *minio.Client, bucket, prefix string) walkerFn { - return func(p string) <-chan fileInfo { - ret := make(chan fileInfo) - go func() { - defer close(ret) //nolint - ao := minio.ListObjectsOptions{ - Recursive: true, - } - if prefix != "" { - ao.Prefix = prefix - } - info := m.ListObjects(context.Background(), bucket, ao) - for { - val, ok := <-info - if !ok { - return - } - ret <- &objectInfo{ - info: val, - name: filepath.Join(bucket, val.Key), - } - } - }() - return ret - } -} diff --git a/schema/cosa/schema_doc.go b/schema/cosa/schema_doc.go deleted file mode 100644 index e1ddd61c12581995b2223dbbbe1f59dd8e8004eb..0000000000000000000000000000000000000000 --- a/schema/cosa/schema_doc.go +++ /dev/null @@ -1,869 +0,0 @@ -// Generated by ./generate-schema.sh -// DO NOT EDIT - -package cosa - -var generatedSchemaJSON = `{ - "definitions": { - "artifact": { - "type": "object", - "properties": { - "path": { - "$id": "#/artifact/Path", - "type":"string", - "title":"Path" - }, - "sha256": { - "$id": "#/artifact/sha256", - "type":"string", - "title":"SHA256" - }, - "size": { - "$id": "#/artifact/size", - "type":"number", - "title":"Size in bytes" - }, - "skip-compression": { - "$id": "#/artifact/skip-compression", - "type":"boolean", - "title":"Skip compression", - "description":"Artifact should not be compressed or decompressed before use", - "default":false - }, - "uncompressed-sha256": { - "$id": "#/artifact/uncompressed-sha256", - "type":"string", - "title":"Uncompressed SHA256" - }, - "uncompressed-size": { - "$id": "#/artifact/uncompressed-size", - "type":"integer", - "title":"Uncompressed-size" - } - }, - "optional": [ - "size", - "uncompressed-sha256", - "uncompressed-size", - "skip-compression" - ], - "required": [ - "path", - "sha256" - ] - }, - "image": { - "type": "object", - "required": [ - "digest", - "image" - ], - "optional": [ - "comment" - ], - "properties": { - "digest": { - "$id": "#/image/digest", - "type":"string", - "title":"Digest" - }, - "comment": { - "$id": "#/image/comment", - "type":"string", - "title":"Comment" - }, - "image": { - "$id": "#/image/image", - "type":"string", - "title":"Image" - } - } - }, - "cloudartifact": { - "type": "object", - "required": [ - "url" - ], - "optional": [ - "image", - "object", - "bucket", - "region" - ], - "properties": { - "image": { - "$id":"#/cloudartifact/image", - "type":"string", - "title":"Image" - }, - "url": { - "$id":"#/cloudartifact/url", - "type":"string", - "title":"URL" - }, - "bucket": { - "$id":"#/cloudartifact/bucket", - "type":"string", - "title":"Bucket" - }, - "region": { - "$id":"#/cloudartifact/region", - "type":"string", - "title":"Region" - }, - "object": { - "$id":"#/cloudartifact/object", - "type":"string", - "title":"Object" - } - } - }, - "git": { - "type": "object", - "required": [ - "commit", - "origin" - ], - "optional": [ - "branch", - "dirty" - ], - "properties": { - "branch": { - "$id":"#/git/branch", - "type":"string", - "title":"branch", - "default":"", - "examples": [ - "HEAD" - ], - "minLength": 3 - }, - "commit": { - "$id":"#/git/commit", - "type":"string", - "title":"commit", - "default":"", - "examples": [ - "742edc307e58f35824d906958b6493510e12b593" - ], - "minLength": 5 - }, - "dirty": { - "$id":"#/git/dirty", - "type":"string", - "title":"dirty", - "default":"", - "examples": [ - "true" - ], - "minLength": 1 - }, - "origin": { - "$id":"#/git/origin", - "type":"string", - "title":"origin", - "default":"", - "examples": [ - "https://github.com/coreos/fedora-coreos-config" - ], - "minLength": 1 - } - } - }, - "pkg-items": { - "type":"array", - "title":"Package Set differences", - "items": { - "$id":"#/pkgdiff/items/item", - "title":"Items", - "default":"", - "minLength": 1 - } - }, - "advisory-items": { - "type":"array", - "title":"Advisory diff", - "items": { - "$id":"#/advisory-diff/items/item", - "title":"Items", - "default":"" - } - } - }, - "$schema":"http://json-schema.org/draft-07/schema#", - "$id":"http://github.com/coreos/coreos-assembler/blob/main/v1.json.json", - "type":"object", - "title":"CoreOS Assember v1 meta.json schema", - "required": [ - "buildid", - "name", - "ostree-commit", - "ostree-content-checksum", - "ostree-timestamp", - "ostree-version", - "rpm-ostree-inputhash", - "summary" - ], - "optional": [ - "aliyun", - "amis", - "azure", - "azurestack", - "build-url", - "digitalocean", - "exoscale", - "gcp", - "ibmcloud", - "powervs", - "images", - "koji", - "oscontainer", - "extensions", - "parent-pkgdiff", - "pkgdiff", - "parent-advisories-diff", - "advisories-diff", - "release-payload", - - "coreos-assembler.basearch", - "coreos-assembler.build-timestamp", - "coreos-assembler.code-source", - "coreos-assembler.config-dirty", - "coreos-assembler.config-gitrev", - "coreos-assembler.container-config-git", - "coreos-assembler.container-image-git", - "coreos-assembler.delayed-meta-merge", - "coreos-assembler.image-config-checksum", - "coreos-assembler.image-genver", - "coreos-assembler.image-input-checksum", - "coreos-assembler.meta-stamp", - "coreos-assembler.overrides-active", - "fedora-coreos.parent-commit", - "fedora-coreos.parent-version", - "ref" - ], - "additionalProperties":false, - "properties": { - "ref": { - "$id":"#/properties/ref", - "type":"string", - "title":"BuildRef", - "default":"", - "minLength": 1 - }, - "build-url": { - "$id":"#/properties/build-url", - "type":"string", - "title":"Build URL", - "default":"", - "minLength": 1 - }, - "buildid": { - "$id":"#/properties/buildid", - "type":"string", - "title":"BuildID", - "default":"", - "minLength": 1 - }, - "koji": { - "type": "object", - "properties": { - "build_id": { - "$id":"#/properties/kojiid", - "type":"number", - "title":"Koji Build ID" - }, - "token": { - "$id":"#/properties/kojitoken", - "type":"string", - "title":"Koji Token" - }, - "release": { - "$id":"#/properties/buildrelease", - "type":"string", - "title":"Build Release" - } - } - }, - "coreos-assembler.basearch": { - "$id":"#/properties/coreos-assembler.basearch", - "type":"string", - "title":"Architecture", - "default":"", - "minLength": 1 - }, - "coreos-assembler.build-timestamp": { - "$id":"#/properties/coreos-assembler.build-timestamp", - "type":"string", - "title":"Build Time Stamp", - "default":"", - "minLength": 1 - }, - "coreos-assembler.code-source": { - "$id":"#/properties/coreos-assembler.code-source", - "type":"string", - "title":"CoreOS Source", - "default":"", - "minLength": 1 - }, - "coreos-assembler.config-dirty": { - "$id":"#/properties/coreos-assembler.config-dirty", - "type":"string", - "title":"GitDirty", - "default":"", - "minLength": 1 - }, - "coreos-assembler.config-gitrev": { - "$id":"#/properties/coreos-assembler.config-gitrev", - "type":"string", - "title":"Config GitRev", - "default":"", - "minLength": 1 - }, - "coreos-assembler.container-config-git": { - "$id":"#/properties/coreos-assembler.container-config-git", - "type":"object", - "title":"Container Config GIT", - "$ref": "#/definitions/git" - }, - "coreos-assembler.container-image-git": { - "$id":"#/properties/coreos-assembler.container-image-git", - "type":"object", - "title":"COSA Container Image Git", - "$ref": "#/definitions/git" - }, - "coreos-assembler.delayed-meta-merge": { - "$id":"#/properties/coreos-assembler.delayed-meta-merge", - "type":"boolean", - "title":"COSA Delayed Meta Merge", - "default": "False" - }, - "coreos-assembler.meta-stamp": { - "$id":"#/properties/coreos-assembler.meta-stamp", - "type":"number", - "title":"Meta Stamp", - "default":"", - "minLength": 16 - }, - "fedora-coreos.parent-version": { - "$id":"#/properties/fedora-coreos.parent-version", - "type":"string", - "title":"Fedora CoreOS Parent Version", - "default":"", - "minLength": 12 - }, - "fedora-coreos.parent-commit": { - "$id":"#/properties/fedora-coreos.parent-commit", - "type":"string", - "title":"Fedora CoreOS parent commit", - "default":"", - "examples": [ - "f15f5b25cf138a7683e3d200c53ece2091bf71d31332135da87892ab72ff4ee3" - ], - "minLength": 64 - }, - "coreos-assembler.image-config-checksum": { - "$id":"#/properties/coreos-assembler.image-config-checksum", - "type":"string", - "title":"COSA image checksum", - "default":"", - "minLength": 64 - }, - "coreos-assembler.image-genver": { - "$id":"#/properties/coreos-assembler.image-genver", - "type":"integer", - "title":"COSA Image Version", - "default": 0, - "examples": [ - 0 - ] - }, - "coreos-assembler.image-input-checksum": { - "$id":"#/properties/coreos-assembler.image-input-checksum", - "type":"string", - "title":"Image input checksum", - "default":"", - "minLength": 64 - }, - "coreos-assembler.overrides-active": { - "$id":"#/properties/coreos-assembler.overrides-active", - "title":"Overrides Active", - "default":"", - "type": "boolean" - }, - "images": { - "$id":"#/properties/images", - "type":"object", - "title":"Build Artifacts", - "required": [ - "ostree" - ], - "optional": [ - "aliyun", - "aws", - "azure", - "azurestack", - "dasd", - "digitalocean", - "exoscale", - "gcp", - "ibmcloud", - "powervs", - "initramfs", - "iso", - "kernel", - "live-kernel", - "live-initramfs", - "live-iso", - "live-rootfs", - "metal", - "metal4k", - "nutanix", - "openstack", - "qemu", - "vmware", - "vultr" - ], - "properties": { - "ostree": { - "$id":"#/properties/images/properties/ostree", - "type":"object", - "title":"OSTree", - "$ref": "#/definitions/artifact" - }, - "dasd": { - "$id":"#/properties/images/properties/dasd", - "type":"object", - "title":"dasd", - "$ref": "#/definitions/artifact" - }, - "exoscale": { - "$id":"#/properties/images/properties/exoscale", - "type":"object", - "title":"exoscale", - "$ref": "#/definitions/artifact" - }, - "qemu": { - "$id":"#/properties/images/properties/qemu", - "type":"object", - "title":"Qemu", - "$ref": "#/definitions/artifact" - }, - "metal": { - "$id":"#/properties/images/properties/metal", - "type":"object", - "title":"Metal", - "$ref": "#/definitions/artifact" - }, - "metal4k": { - "$id":"#/properties/images/properties/metal4k", - "type":"object", - "title":"Metal (4K native)", - "$ref": "#/definitions/artifact" - }, - "iso": { - "$id":"#/properties/images/properties/iso", - "type":"object", - "title":"ISO", - "$ref": "#/definitions/artifact" - }, - "kernel": { - "$id":"#/properties/images/properties/kernel", - "type":"object", - "title":"Kernel", - "$ref": "#/definitions/artifact" - }, - "initramfs": { - "$id":"#/properties/images/properties/initramfs", - "type":"object", - "title":"Initramfs", - "$ref": "#/definitions/artifact" - }, - "live-kernel": { - "$id":"#/properties/images/properties/live-kernel", - "type":"object", - "title":"Live Kernel", - "$ref": "#/definitions/artifact" - }, - "live-initramfs": { - "$id":"#/properties/images/properties/live-initramfs", - "type":"object", - "title":"Live Initramfs", - "$ref": "#/definitions/artifact" - }, - "live-iso": { - "$id":"#/properties/images/properties/live-iso", - "type":"object", - "title":"Live ISO", - "$ref": "#/definitions/artifact" - }, - "live-rootfs": { - "$id":"#/properties/images/properties/live-rootfs", - "type":"object", - "title":"Live Rootfs", - "$ref": "#/definitions/artifact" - }, - "nutanix": { - "$id":"#/properties/images/properties/nutanix", - "type":"object", - "title":"Nutanix", - "$ref": "#/definitions/artifact" - }, - "openstack": { - "$id":"#/properties/images/properties/openstack", - "type":"object", - "title":"OpenStack", - "$ref": "#/definitions/artifact" - }, - "vmware": { - "$id":"#/properties/images/properties/vmware", - "type":"object", - "title":"VMWare", - "$ref": "#/definitions/artifact" - }, - "vultr": { - "$id": "#/properties/images/properties/vultr", - "type": "object", - "title": "Vultr", - "$ref": "#/definitions/artifact" - }, - "aliyun": { - "$id":"#/properties/images/properties/aliyun", - "type":"object", - "title":"Aliyun", - "$ref": "#/definitions/artifact" - }, - "aws": { - "$id":"#/properties/images/properties/aws", - "type":"object", - "title":"AWS", - "$ref": "#/definitions/artifact" - }, - "azure": { - "$id":"#/properties/images/properties/azure", - "type":"object", - "title":"Azure", - "$ref": "#/definitions/artifact" - }, - "azurestack": { - "$id":"#/properties/images/properties/azurestack", - "type":"object", - "title":"AzureStack", - "$ref": "#/definitions/artifact" - }, - "digitalocean": { - "$id":"#/properties/images/properties/digitalocean", - "type":"object", - "title":"DigitalOcean", - "$ref": "#/definitions/artifact" - }, - "ibmcloud": { - "$id":"#/properties/images/properties/ibmcloud", - "type":"object", - "title":"IBM Cloud", - "$ref": "#/definitions/artifact" - }, - "powervs": { - "$id":"#/properties/images/properties/powervs", - "type":"object", - "title":"Power Virtual Server", - "$ref": "#/definitions/artifact" - }, - "gcp": { - "$id":"#/properties/images/properties/gcp", - "type":"object", - "title":"GCP", - "$ref": "#/definitions/artifact" - } - } - }, - "name": { - "$id":"#/properties/name", - "type":"string", - "title":"Name", - "default":"fedora-coreos", - "examples": [ - "rhcos", - "fedora-coreos" - ] - }, - "oscontainer": { - "$id":"#/properties/oscontainer", - "type":"object", - "title":"Oscontainer", - "$ref": "#/definitions/image" - }, - "extensions": { - "$id":"#/properties/extensions", - "type":"object", - "title":"Extensions", - "required": [ - "path", - "sha256", - "rpm-ostree-state", - "manifest" - ], - "properties": { - "path": { - "$id": "#/artifact/Path", - "type":"string", - "title":"Path" - }, - "sha256": { - "$id": "#/artifact/sha256", - "type":"string", - "title":"SHA256" - }, - "rpm-ostree-state": { - "$id":"#/properties/extensions/items/properties/rpm-ostree-state", - "type":"string", - "title":"RpmOstreeState", - "default":"", - "minLength": 64 - }, - "manifest": { - "$id":"#/properties/extensions/items/properties/manifest", - "type":"object", - "title":"Manifest" - } - } - }, - "ostree-commit": { - "$id":"#/properties/ostree-commit", - "type":"string", - "title":"ostree-commit", - "default":"", - "minLength": 64 - }, - "ostree-content-bytes-written": { - "$id":"#/properties/ostree-content-bytes-written", - "type":"integer", - "title":"ostree-content-bytes-written", - "default": 0 - }, - "ostree-content-checksum": { - "$id":"#/properties/ostree-content-checksum", - "type":"string", - "title":"ostree-content-checksum", - "default":"", - "minLength": 64 - }, - "ostree-n-cache-hits": { - "$id":"#/properties/ostree-n-cache-hits", - "type":"integer", - "title":"ostree-n-cache-hits", - "default": 0 - }, - "ostree-n-content-total": { - "$id":"#/properties/ostree-n-content-total", - "type":"integer", - "title":"ostree-n-content-total", - "default": 0 - }, - "ostree-n-content-written": { - "$id":"#/properties/ostree-n-content-written", - "type":"integer", - "title":"ostree-n-content-written", - "default": 0 - }, - "ostree-n-metadata-total": { - "$id":"#/properties/ostree-n-metadata-total", - "type":"integer", - "title":"ostree-n-metadata-total", - "default": 0 - }, - "ostree-n-metadata-written": { - "$id":"#/properties/ostree-n-metadata-written", - "type":"integer", - "title":"ostree-n-metadata-written", - "default": 0 - }, - "ostree-timestamp": { - "$id":"#/properties/ostree-timestamp", - "type":"string", - "title":"ostree timestamp", - "default":"", - "examples": [ - "2020-01-15T19:31:31Z" - ], - "pattern":"\\d{4}-\\d{2}-\\d{2}T.*Z$" - }, - "ostree-version": { - "$id":"#/properties/ostree-version", - "type":"string", - "title":"ostree version", - "default":"", - "minLength": 1 - }, - "pkgdiff": { - "$id":"#/properties/pkgdiff", - "type":"array", - "title":"pkgdiff between builds", - "$ref": "#/definitions/pkg-items" - }, - "parent-pkgdiff": { - "$id":"#/properties/parent-pkgdiff", - "type":"array", - "title":"pkgdiff against parent", - "$ref": "#/definitions/pkg-items" - }, - "advisories-diff": { - "$id":"#/properties/advisories-diff", - "type":"array", - "title":"advisory diff between builds", - "$ref": "#/definitions/advisory-items" - }, - "parent-advisories-diff": { - "$id":"#/properties/parent-advisory-diff", - "type":"array", - "title":"advisory diff against parent", - "$ref": "#/definitions/advisory-items" - }, - "rpm-ostree-inputhash": { - "$id":"#/properties/rpm-ostree-inputhash", - "type":"string", - "title":"input has of the rpm-ostree", - "default":"", - "minLength": 64 - }, - "summary": { - "$id":"#/properties/summary", - "type":"string", - "title":"Build Summary", - "default":"", - "minLength": 1 - }, - "aliyun": { - "$id":"#/properties/aliyun", - "type":"array", - "title":"Alibaba/Aliyun Uploads", - "items": { - "$id":"#/properties/aliyun/images", - "type":"object", - "title":"Aliyun Image", - "required": [ - "name", - "id" - ], - "properties": { - "name": { - "$id":"#/properties/aliyun/items/properties/name", - "type":"string", - "title":"Region", - "default":"", - "minLength": 1 - }, - "id": { - "$id":"#/properties/aliyun/items/properties/id", - "type":"string", - "title":"ImageID", - "default":"", - "minLength": 1 - } - } - } - }, - "amis": { - "$id":"#/properties/amis", - "type":"array", - "title":"AMIS", - "items": { - "$id":"#/properties/amis/items", - "type":"object", - "title":"AMIS", - "required": [ - "name", - "hvm", - "snapshot" - ], - "properties": { - "name": { - "$id":"#/properties/amis/items/properties/name", - "type":"string", - "title":"Region", - "default":"" - }, - "hvm": { - "$id":"#/properties/amis/items/properties/hvm", - "type":"string", - "title":"HVM", - "default":"" - }, - "snapshot": { - "$id":"#/properties/amis/items/properties/snapshot", - "type":"string", - "title":"Snapshot", - "default":"" - } - } - } - }, - "azure": { - "$id":"#/properties/azure", - "type":"object", - "title":"Azure", - "$ref": "#/definitions/cloudartifact" - }, - "gcp": { - "$id":"#/properties/gcp", - "type":"object", - "title":"GCP", - "required": [ - "image", - "url" - ], - "optional": [ - "family", - "project" - ], - "properties": { - "image": { - "$id":"#/properties/gcp/image", - "type":"string", - "title":"Image Name" - }, - "url": { - "$id":"#/properties/gcp/url", - "type":"string", - "title":"URL" - }, - "project": { - "$id":"#/properties/gcp/project", - "type":"string", - "title":"Image Project" - }, - "family": { - "$id":"#/properties/gcp/family", - "type":"string", - "title":"Image Family" - } - } - }, - "ibmcloud": { - "$id":"#/properties/ibmcloud", - "type":"array", - "title":"IBM Cloud", - "items": { - "type":"object", - "$ref": "#/definitions/cloudartifact" - } - }, - "powervs": { - "$id":"#/properties/powervs", - "type":"array", - "title":"Power Virtual Server", - "items": { - "type":"object", - "$ref": "#/definitions/cloudartifact" - } - }, - "release-payload": { - "$id":"#/properties/release-payload", - "type":"object", - "title":"ReleasePayload", - "$ref": "#/definitions/image" - } - } -} -` diff --git a/schema/generate-schema.sh b/schema/generate-schema.sh index e70baed327054f8cca0e5771c35f5f9c346e9361..d8f4037fc5631f2d2d3d7cc41dcfeddc55282276 100755 --- a/schema/generate-schema.sh +++ b/schema/generate-schema.sh @@ -18,7 +18,7 @@ out="${tdir}/cosa_${schema_version}.go" "${GOBIN}/schematyper" \ "${schema_version}.json" \ -o "${out}" \ - --package="cosa" \ + --package="builds" \ --root-type=Build \ --ptr-for-omit diff --git a/schema/v1.json b/schema/v1.json deleted file mode 100644 index 385eb73b44b3387bd12465f513ddfa1ab9fed2ef..0000000000000000000000000000000000000000 --- a/schema/v1.json +++ /dev/null @@ -1,863 +0,0 @@ -{ - "definitions": { - "artifact": { - "type": "object", - "properties": { - "path": { - "$id": "#/artifact/Path", - "type":"string", - "title":"Path" - }, - "sha256": { - "$id": "#/artifact/sha256", - "type":"string", - "title":"SHA256" - }, - "size": { - "$id": "#/artifact/size", - "type":"number", - "title":"Size in bytes" - }, - "skip-compression": { - "$id": "#/artifact/skip-compression", - "type":"boolean", - "title":"Skip compression", - "description":"Artifact should not be compressed or decompressed before use", - "default":false - }, - "uncompressed-sha256": { - "$id": "#/artifact/uncompressed-sha256", - "type":"string", - "title":"Uncompressed SHA256" - }, - "uncompressed-size": { - "$id": "#/artifact/uncompressed-size", - "type":"integer", - "title":"Uncompressed-size" - } - }, - "optional": [ - "size", - "uncompressed-sha256", - "uncompressed-size", - "skip-compression" - ], - "required": [ - "path", - "sha256" - ] - }, - "image": { - "type": "object", - "required": [ - "digest", - "image" - ], - "optional": [ - "comment" - ], - "properties": { - "digest": { - "$id": "#/image/digest", - "type":"string", - "title":"Digest" - }, - "comment": { - "$id": "#/image/comment", - "type":"string", - "title":"Comment" - }, - "image": { - "$id": "#/image/image", - "type":"string", - "title":"Image" - } - } - }, - "cloudartifact": { - "type": "object", - "required": [ - "url" - ], - "optional": [ - "image", - "object", - "bucket", - "region" - ], - "properties": { - "image": { - "$id":"#/cloudartifact/image", - "type":"string", - "title":"Image" - }, - "url": { - "$id":"#/cloudartifact/url", - "type":"string", - "title":"URL" - }, - "bucket": { - "$id":"#/cloudartifact/bucket", - "type":"string", - "title":"Bucket" - }, - "region": { - "$id":"#/cloudartifact/region", - "type":"string", - "title":"Region" - }, - "object": { - "$id":"#/cloudartifact/object", - "type":"string", - "title":"Object" - } - } - }, - "git": { - "type": "object", - "required": [ - "commit", - "origin" - ], - "optional": [ - "branch", - "dirty" - ], - "properties": { - "branch": { - "$id":"#/git/branch", - "type":"string", - "title":"branch", - "default":"", - "examples": [ - "HEAD" - ], - "minLength": 3 - }, - "commit": { - "$id":"#/git/commit", - "type":"string", - "title":"commit", - "default":"", - "examples": [ - "742edc307e58f35824d906958b6493510e12b593" - ], - "minLength": 5 - }, - "dirty": { - "$id":"#/git/dirty", - "type":"string", - "title":"dirty", - "default":"", - "examples": [ - "true" - ], - "minLength": 1 - }, - "origin": { - "$id":"#/git/origin", - "type":"string", - "title":"origin", - "default":"", - "examples": [ - "https://github.com/coreos/fedora-coreos-config" - ], - "minLength": 1 - } - } - }, - "pkg-items": { - "type":"array", - "title":"Package Set differences", - "items": { - "$id":"#/pkgdiff/items/item", - "title":"Items", - "default":"", - "minLength": 1 - } - }, - "advisory-items": { - "type":"array", - "title":"Advisory diff", - "items": { - "$id":"#/advisory-diff/items/item", - "title":"Items", - "default":"" - } - } - }, - "$schema":"http://json-schema.org/draft-07/schema#", - "$id":"http://github.com/coreos/coreos-assembler/blob/main/v1.json.json", - "type":"object", - "title":"CoreOS Assember v1 meta.json schema", - "required": [ - "buildid", - "name", - "ostree-commit", - "ostree-content-checksum", - "ostree-timestamp", - "ostree-version", - "rpm-ostree-inputhash", - "summary" - ], - "optional": [ - "aliyun", - "amis", - "azure", - "azurestack", - "build-url", - "digitalocean", - "exoscale", - "gcp", - "ibmcloud", - "powervs", - "images", - "koji", - "oscontainer", - "extensions", - "parent-pkgdiff", - "pkgdiff", - "parent-advisories-diff", - "advisories-diff", - "release-payload", - - "coreos-assembler.basearch", - "coreos-assembler.build-timestamp", - "coreos-assembler.code-source", - "coreos-assembler.config-dirty", - "coreos-assembler.config-gitrev", - "coreos-assembler.container-config-git", - "coreos-assembler.container-image-git", - "coreos-assembler.delayed-meta-merge", - "coreos-assembler.image-config-checksum", - "coreos-assembler.image-genver", - "coreos-assembler.image-input-checksum", - "coreos-assembler.meta-stamp", - "coreos-assembler.overrides-active", - "fedora-coreos.parent-commit", - "fedora-coreos.parent-version", - "ref" - ], - "additionalProperties":false, - "properties": { - "ref": { - "$id":"#/properties/ref", - "type":"string", - "title":"BuildRef", - "default":"", - "minLength": 1 - }, - "build-url": { - "$id":"#/properties/build-url", - "type":"string", - "title":"Build URL", - "default":"", - "minLength": 1 - }, - "buildid": { - "$id":"#/properties/buildid", - "type":"string", - "title":"BuildID", - "default":"", - "minLength": 1 - }, - "koji": { - "type": "object", - "properties": { - "build_id": { - "$id":"#/properties/kojiid", - "type":"number", - "title":"Koji Build ID" - }, - "token": { - "$id":"#/properties/kojitoken", - "type":"string", - "title":"Koji Token" - }, - "release": { - "$id":"#/properties/buildrelease", - "type":"string", - "title":"Build Release" - } - } - }, - "coreos-assembler.basearch": { - "$id":"#/properties/coreos-assembler.basearch", - "type":"string", - "title":"Architecture", - "default":"", - "minLength": 1 - }, - "coreos-assembler.build-timestamp": { - "$id":"#/properties/coreos-assembler.build-timestamp", - "type":"string", - "title":"Build Time Stamp", - "default":"", - "minLength": 1 - }, - "coreos-assembler.code-source": { - "$id":"#/properties/coreos-assembler.code-source", - "type":"string", - "title":"CoreOS Source", - "default":"", - "minLength": 1 - }, - "coreos-assembler.config-dirty": { - "$id":"#/properties/coreos-assembler.config-dirty", - "type":"string", - "title":"GitDirty", - "default":"", - "minLength": 1 - }, - "coreos-assembler.config-gitrev": { - "$id":"#/properties/coreos-assembler.config-gitrev", - "type":"string", - "title":"Config GitRev", - "default":"", - "minLength": 1 - }, - "coreos-assembler.container-config-git": { - "$id":"#/properties/coreos-assembler.container-config-git", - "type":"object", - "title":"Container Config GIT", - "$ref": "#/definitions/git" - }, - "coreos-assembler.container-image-git": { - "$id":"#/properties/coreos-assembler.container-image-git", - "type":"object", - "title":"COSA Container Image Git", - "$ref": "#/definitions/git" - }, - "coreos-assembler.delayed-meta-merge": { - "$id":"#/properties/coreos-assembler.delayed-meta-merge", - "type":"boolean", - "title":"COSA Delayed Meta Merge", - "default": "False" - }, - "coreos-assembler.meta-stamp": { - "$id":"#/properties/coreos-assembler.meta-stamp", - "type":"number", - "title":"Meta Stamp", - "default":"", - "minLength": 16 - }, - "fedora-coreos.parent-version": { - "$id":"#/properties/fedora-coreos.parent-version", - "type":"string", - "title":"Fedora CoreOS Parent Version", - "default":"", - "minLength": 12 - }, - "fedora-coreos.parent-commit": { - "$id":"#/properties/fedora-coreos.parent-commit", - "type":"string", - "title":"Fedora CoreOS parent commit", - "default":"", - "examples": [ - "f15f5b25cf138a7683e3d200c53ece2091bf71d31332135da87892ab72ff4ee3" - ], - "minLength": 64 - }, - "coreos-assembler.image-config-checksum": { - "$id":"#/properties/coreos-assembler.image-config-checksum", - "type":"string", - "title":"COSA image checksum", - "default":"", - "minLength": 64 - }, - "coreos-assembler.image-genver": { - "$id":"#/properties/coreos-assembler.image-genver", - "type":"integer", - "title":"COSA Image Version", - "default": 0, - "examples": [ - 0 - ] - }, - "coreos-assembler.image-input-checksum": { - "$id":"#/properties/coreos-assembler.image-input-checksum", - "type":"string", - "title":"Image input checksum", - "default":"", - "minLength": 64 - }, - "coreos-assembler.overrides-active": { - "$id":"#/properties/coreos-assembler.overrides-active", - "title":"Overrides Active", - "default":"", - "type": "boolean" - }, - "images": { - "$id":"#/properties/images", - "type":"object", - "title":"Build Artifacts", - "required": [ - "ostree" - ], - "optional": [ - "aliyun", - "aws", - "azure", - "azurestack", - "dasd", - "digitalocean", - "exoscale", - "gcp", - "ibmcloud", - "powervs", - "initramfs", - "iso", - "kernel", - "live-kernel", - "live-initramfs", - "live-iso", - "live-rootfs", - "metal", - "metal4k", - "nutanix", - "openstack", - "qemu", - "vmware", - "vultr" - ], - "properties": { - "ostree": { - "$id":"#/properties/images/properties/ostree", - "type":"object", - "title":"OSTree", - "$ref": "#/definitions/artifact" - }, - "dasd": { - "$id":"#/properties/images/properties/dasd", - "type":"object", - "title":"dasd", - "$ref": "#/definitions/artifact" - }, - "exoscale": { - "$id":"#/properties/images/properties/exoscale", - "type":"object", - "title":"exoscale", - "$ref": "#/definitions/artifact" - }, - "qemu": { - "$id":"#/properties/images/properties/qemu", - "type":"object", - "title":"Qemu", - "$ref": "#/definitions/artifact" - }, - "metal": { - "$id":"#/properties/images/properties/metal", - "type":"object", - "title":"Metal", - "$ref": "#/definitions/artifact" - }, - "metal4k": { - "$id":"#/properties/images/properties/metal4k", - "type":"object", - "title":"Metal (4K native)", - "$ref": "#/definitions/artifact" - }, - "iso": { - "$id":"#/properties/images/properties/iso", - "type":"object", - "title":"ISO", - "$ref": "#/definitions/artifact" - }, - "kernel": { - "$id":"#/properties/images/properties/kernel", - "type":"object", - "title":"Kernel", - "$ref": "#/definitions/artifact" - }, - "initramfs": { - "$id":"#/properties/images/properties/initramfs", - "type":"object", - "title":"Initramfs", - "$ref": "#/definitions/artifact" - }, - "live-kernel": { - "$id":"#/properties/images/properties/live-kernel", - "type":"object", - "title":"Live Kernel", - "$ref": "#/definitions/artifact" - }, - "live-initramfs": { - "$id":"#/properties/images/properties/live-initramfs", - "type":"object", - "title":"Live Initramfs", - "$ref": "#/definitions/artifact" - }, - "live-iso": { - "$id":"#/properties/images/properties/live-iso", - "type":"object", - "title":"Live ISO", - "$ref": "#/definitions/artifact" - }, - "live-rootfs": { - "$id":"#/properties/images/properties/live-rootfs", - "type":"object", - "title":"Live Rootfs", - "$ref": "#/definitions/artifact" - }, - "nutanix": { - "$id":"#/properties/images/properties/nutanix", - "type":"object", - "title":"Nutanix", - "$ref": "#/definitions/artifact" - }, - "openstack": { - "$id":"#/properties/images/properties/openstack", - "type":"object", - "title":"OpenStack", - "$ref": "#/definitions/artifact" - }, - "vmware": { - "$id":"#/properties/images/properties/vmware", - "type":"object", - "title":"VMWare", - "$ref": "#/definitions/artifact" - }, - "vultr": { - "$id": "#/properties/images/properties/vultr", - "type": "object", - "title": "Vultr", - "$ref": "#/definitions/artifact" - }, - "aliyun": { - "$id":"#/properties/images/properties/aliyun", - "type":"object", - "title":"Aliyun", - "$ref": "#/definitions/artifact" - }, - "aws": { - "$id":"#/properties/images/properties/aws", - "type":"object", - "title":"AWS", - "$ref": "#/definitions/artifact" - }, - "azure": { - "$id":"#/properties/images/properties/azure", - "type":"object", - "title":"Azure", - "$ref": "#/definitions/artifact" - }, - "azurestack": { - "$id":"#/properties/images/properties/azurestack", - "type":"object", - "title":"AzureStack", - "$ref": "#/definitions/artifact" - }, - "digitalocean": { - "$id":"#/properties/images/properties/digitalocean", - "type":"object", - "title":"DigitalOcean", - "$ref": "#/definitions/artifact" - }, - "ibmcloud": { - "$id":"#/properties/images/properties/ibmcloud", - "type":"object", - "title":"IBM Cloud", - "$ref": "#/definitions/artifact" - }, - "powervs": { - "$id":"#/properties/images/properties/powervs", - "type":"object", - "title":"Power Virtual Server", - "$ref": "#/definitions/artifact" - }, - "gcp": { - "$id":"#/properties/images/properties/gcp", - "type":"object", - "title":"GCP", - "$ref": "#/definitions/artifact" - } - } - }, - "name": { - "$id":"#/properties/name", - "type":"string", - "title":"Name", - "default":"fedora-coreos", - "examples": [ - "rhcos", - "fedora-coreos" - ] - }, - "oscontainer": { - "$id":"#/properties/oscontainer", - "type":"object", - "title":"Oscontainer", - "$ref": "#/definitions/image" - }, - "extensions": { - "$id":"#/properties/extensions", - "type":"object", - "title":"Extensions", - "required": [ - "path", - "sha256", - "rpm-ostree-state", - "manifest" - ], - "properties": { - "path": { - "$id": "#/artifact/Path", - "type":"string", - "title":"Path" - }, - "sha256": { - "$id": "#/artifact/sha256", - "type":"string", - "title":"SHA256" - }, - "rpm-ostree-state": { - "$id":"#/properties/extensions/items/properties/rpm-ostree-state", - "type":"string", - "title":"RpmOstreeState", - "default":"", - "minLength": 64 - }, - "manifest": { - "$id":"#/properties/extensions/items/properties/manifest", - "type":"object", - "title":"Manifest" - } - } - }, - "ostree-commit": { - "$id":"#/properties/ostree-commit", - "type":"string", - "title":"ostree-commit", - "default":"", - "minLength": 64 - }, - "ostree-content-bytes-written": { - "$id":"#/properties/ostree-content-bytes-written", - "type":"integer", - "title":"ostree-content-bytes-written", - "default": 0 - }, - "ostree-content-checksum": { - "$id":"#/properties/ostree-content-checksum", - "type":"string", - "title":"ostree-content-checksum", - "default":"", - "minLength": 64 - }, - "ostree-n-cache-hits": { - "$id":"#/properties/ostree-n-cache-hits", - "type":"integer", - "title":"ostree-n-cache-hits", - "default": 0 - }, - "ostree-n-content-total": { - "$id":"#/properties/ostree-n-content-total", - "type":"integer", - "title":"ostree-n-content-total", - "default": 0 - }, - "ostree-n-content-written": { - "$id":"#/properties/ostree-n-content-written", - "type":"integer", - "title":"ostree-n-content-written", - "default": 0 - }, - "ostree-n-metadata-total": { - "$id":"#/properties/ostree-n-metadata-total", - "type":"integer", - "title":"ostree-n-metadata-total", - "default": 0 - }, - "ostree-n-metadata-written": { - "$id":"#/properties/ostree-n-metadata-written", - "type":"integer", - "title":"ostree-n-metadata-written", - "default": 0 - }, - "ostree-timestamp": { - "$id":"#/properties/ostree-timestamp", - "type":"string", - "title":"ostree timestamp", - "default":"", - "examples": [ - "2020-01-15T19:31:31Z" - ], - "pattern":"\\d{4}-\\d{2}-\\d{2}T.*Z$" - }, - "ostree-version": { - "$id":"#/properties/ostree-version", - "type":"string", - "title":"ostree version", - "default":"", - "minLength": 1 - }, - "pkgdiff": { - "$id":"#/properties/pkgdiff", - "type":"array", - "title":"pkgdiff between builds", - "$ref": "#/definitions/pkg-items" - }, - "parent-pkgdiff": { - "$id":"#/properties/parent-pkgdiff", - "type":"array", - "title":"pkgdiff against parent", - "$ref": "#/definitions/pkg-items" - }, - "advisories-diff": { - "$id":"#/properties/advisories-diff", - "type":"array", - "title":"advisory diff between builds", - "$ref": "#/definitions/advisory-items" - }, - "parent-advisories-diff": { - "$id":"#/properties/parent-advisory-diff", - "type":"array", - "title":"advisory diff against parent", - "$ref": "#/definitions/advisory-items" - }, - "rpm-ostree-inputhash": { - "$id":"#/properties/rpm-ostree-inputhash", - "type":"string", - "title":"input has of the rpm-ostree", - "default":"", - "minLength": 64 - }, - "summary": { - "$id":"#/properties/summary", - "type":"string", - "title":"Build Summary", - "default":"", - "minLength": 1 - }, - "aliyun": { - "$id":"#/properties/aliyun", - "type":"array", - "title":"Alibaba/Aliyun Uploads", - "items": { - "$id":"#/properties/aliyun/images", - "type":"object", - "title":"Aliyun Image", - "required": [ - "name", - "id" - ], - "properties": { - "name": { - "$id":"#/properties/aliyun/items/properties/name", - "type":"string", - "title":"Region", - "default":"", - "minLength": 1 - }, - "id": { - "$id":"#/properties/aliyun/items/properties/id", - "type":"string", - "title":"ImageID", - "default":"", - "minLength": 1 - } - } - } - }, - "amis": { - "$id":"#/properties/amis", - "type":"array", - "title":"AMIS", - "items": { - "$id":"#/properties/amis/items", - "type":"object", - "title":"AMIS", - "required": [ - "name", - "hvm", - "snapshot" - ], - "properties": { - "name": { - "$id":"#/properties/amis/items/properties/name", - "type":"string", - "title":"Region", - "default":"" - }, - "hvm": { - "$id":"#/properties/amis/items/properties/hvm", - "type":"string", - "title":"HVM", - "default":"" - }, - "snapshot": { - "$id":"#/properties/amis/items/properties/snapshot", - "type":"string", - "title":"Snapshot", - "default":"" - } - } - } - }, - "azure": { - "$id":"#/properties/azure", - "type":"object", - "title":"Azure", - "$ref": "#/definitions/cloudartifact" - }, - "gcp": { - "$id":"#/properties/gcp", - "type":"object", - "title":"GCP", - "required": [ - "image", - "url" - ], - "optional": [ - "family", - "project" - ], - "properties": { - "image": { - "$id":"#/properties/gcp/image", - "type":"string", - "title":"Image Name" - }, - "url": { - "$id":"#/properties/gcp/url", - "type":"string", - "title":"URL" - }, - "project": { - "$id":"#/properties/gcp/project", - "type":"string", - "title":"Image Project" - }, - "family": { - "$id":"#/properties/gcp/family", - "type":"string", - "title":"Image Family" - } - } - }, - "ibmcloud": { - "$id":"#/properties/ibmcloud", - "type":"array", - "title":"IBM Cloud", - "items": { - "type":"object", - "$ref": "#/definitions/cloudartifact" - } - }, - "powervs": { - "$id":"#/properties/powervs", - "type":"array", - "title":"Power Virtual Server", - "items": { - "type":"object", - "$ref": "#/definitions/cloudartifact" - } - }, - "release-payload": { - "$id":"#/properties/release-payload", - "type":"object", - "title":"ReleasePayload", - "$ref": "#/definitions/image" - } - } -} diff --git a/schema/v1.json b/schema/v1.json new file mode 120000 index 0000000000000000000000000000000000000000..029e9b99ce1fb08e7f87410e062b96386d80e568 --- /dev/null +++ b/schema/v1.json @@ -0,0 +1 @@ +../src/v1.json \ No newline at end of file