gofmt
This commit is contained in:
parent
f2e3de4b5d
commit
40fd4646ce
9 changed files with 187 additions and 189 deletions
|
@ -2,8 +2,8 @@ package main
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"git.deuxfleurs.fr/deuxfleurs/albatros/cmd"
|
||||
"os"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
package cmd
|
||||
|
||||
import (
|
||||
"crypto/sha256"
|
||||
"errors"
|
||||
"context"
|
||||
"crypto/sha256"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"os"
|
||||
|
@ -13,17 +13,17 @@ import (
|
|||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/containers/image/v5/transports/alltransports"
|
||||
"github.com/containers/image/v5/signature"
|
||||
"github.com/containers/image/v5/copy"
|
||||
"github.com/containers/image/v5/signature"
|
||||
"github.com/containers/image/v5/transports/alltransports"
|
||||
"github.com/spf13/cobra"
|
||||
"gocloud.dev/blob"
|
||||
_ "gocloud.dev/blob/s3blob"
|
||||
)
|
||||
|
||||
var pctx *signature.PolicyContext
|
||||
const distributionPrefix = "v2"
|
||||
|
||||
const distributionPrefix = "v2"
|
||||
|
||||
//---
|
||||
//--- Image converter
|
||||
|
@ -33,6 +33,7 @@ type OCIImageManifest struct {
|
|||
Config OCIRef `json:"config"`
|
||||
Layers []OCIRef `json:layers"`
|
||||
}
|
||||
|
||||
func LoadOCIImageManifest(path string) (*OCIImageManifest, error) {
|
||||
fd, err := os.Open(path)
|
||||
if err != nil {
|
||||
|
@ -71,6 +72,7 @@ type OCIImageIndex struct {
|
|||
MediaType string `json:"mediaType"`
|
||||
Manifests []OCIRef `json:"manifests"`
|
||||
}
|
||||
|
||||
func NewOCIImageIndex(o *OCIMultiArch) (OCIImageIndex, error) {
|
||||
idx := OCIImageIndex{
|
||||
SchemaVersion: 2,
|
||||
|
@ -130,6 +132,7 @@ func (i OCIImageIndex) WriteTo(root string) error {
|
|||
type OCILayout struct {
|
||||
ImageLayoutVersion string `json:"imageLayoutVersion"`
|
||||
}
|
||||
|
||||
func NewOCILayout() OCILayout {
|
||||
return OCILayout{"1.0.0"}
|
||||
}
|
||||
|
@ -151,6 +154,7 @@ type OCISystemImage struct {
|
|||
arch string
|
||||
index *OCIImageIndex
|
||||
}
|
||||
|
||||
func NewOCISystemImage(path, os, arch string) (OCISystemImage, error) {
|
||||
si := OCISystemImage{
|
||||
path: path,
|
||||
|
@ -252,7 +256,6 @@ func (o *OCIMultiArch) LoadFromDockerArchives(path string) error {
|
|||
return err
|
||||
}
|
||||
|
||||
|
||||
// Convert the docker archive to an oci image
|
||||
_, err = copy.Image(context.Background(), pctx, dstRef, srcRef, ©.Options{})
|
||||
if err != nil {
|
||||
|
@ -288,7 +291,6 @@ func (o *OCIMultiArch) MergeSystemImages() error {
|
|||
return err
|
||||
}
|
||||
|
||||
|
||||
// Create the oci-layout file
|
||||
err = NewOCILayout().WriteTo(multiArchRoot)
|
||||
if err != nil {
|
||||
|
@ -308,7 +310,6 @@ func (o *OCIMultiArch) MergeSystemImages() error {
|
|||
o.multi = &idx
|
||||
fmt.Printf("-> index.json\n")
|
||||
|
||||
|
||||
// Copy blobs
|
||||
for _, img := range o.images {
|
||||
blobCounter := 0
|
||||
|
@ -462,7 +463,6 @@ func (o *OCIMultiArch) UploadImageS3(buck *blob.Bucket) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
|
||||
type StaticRegistryManager struct {
|
||||
name string
|
||||
buck *blob.Bucket
|
||||
|
|
|
@ -44,7 +44,6 @@ type Manifest struct {
|
|||
Tags []string `json:"tags"`
|
||||
}
|
||||
|
||||
|
||||
//---
|
||||
//--- Collect data on the filesystem
|
||||
type Platform struct {
|
||||
|
@ -83,7 +82,6 @@ func CollectPlatforms(path string) ([]Platform, error) {
|
|||
filenames = append(filenames, f.Name())
|
||||
}
|
||||
|
||||
|
||||
plat := Platform{
|
||||
OS: osDir.Name(),
|
||||
Arch: archDir.Name(),
|
||||
|
@ -212,6 +210,7 @@ type BucketUploader struct {
|
|||
reader io.ReadCloser
|
||||
options *blob.WriterOptions
|
||||
}
|
||||
|
||||
func NewUploadFromFS(buck *blob.Bucket, path string) (*BucketUploader, error) {
|
||||
fd, err := os.Open(path)
|
||||
if err != nil {
|
||||
|
|
|
@ -1,12 +1,11 @@
|
|||
package pkg
|
||||
|
||||
import (
|
||||
"log"
|
||||
consul "github.com/hashicorp/consul/api"
|
||||
nomad "github.com/hashicorp/nomad/api"
|
||||
"log"
|
||||
)
|
||||
|
||||
|
||||
type Cluster struct {
|
||||
Nomad *nomad.Client
|
||||
Consul *consul.Client
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
package pkg
|
||||
|
||||
import (
|
||||
"log"
|
||||
"fmt"
|
||||
"github.com/caarlos0/env/v7"
|
||||
"log"
|
||||
)
|
||||
|
||||
type Config struct {
|
||||
|
|
|
@ -4,10 +4,10 @@ import (
|
|||
b64 "encoding/base64"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"golang.org/x/exp/slices"
|
||||
"io"
|
||||
"log"
|
||||
"net/http"
|
||||
"golang.org/x/exp/slices"
|
||||
"strings"
|
||||
|
||||
nomad "github.com/hashicorp/nomad/api"
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
package pkg
|
||||
|
||||
import (
|
||||
"log"
|
||||
"code.gitea.io/sdk/gitea"
|
||||
nomad "github.com/hashicorp/nomad/api"
|
||||
"log"
|
||||
)
|
||||
|
||||
type Job struct {
|
||||
|
|
Loading…
Reference in a new issue