From d49b77c8d2ddbdc62d17a9b814db265c16a13c51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Batuhan=20Apayd=C4=B1n?= Date: Tue, 11 Oct 2022 11:17:05 +0300 Subject: [PATCH] chore: bump the pkg/oci package to v0.12.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Batuhan Apaydın --- cmd/flux/build_artifact.go | 9 ++++++--- cmd/flux/push_artifact.go | 13 ++++++++++--- go.mod | 8 ++++---- go.sum | 19 ++++++++++--------- 4 files changed, 30 insertions(+), 19 deletions(-) diff --git a/cmd/flux/build_artifact.go b/cmd/flux/build_artifact.go index 23ac154e..591d4995 100644 --- a/cmd/flux/build_artifact.go +++ b/cmd/flux/build_artifact.go @@ -30,10 +30,13 @@ import ( var buildArtifactCmd = &cobra.Command{ Use: "artifact", Short: "Build artifact", - Long: `The build artifact command creates a tgz file with the manifests from the given directory.`, + Long: `The build artifact command creates a tgz file with the manifests from the given directory or a single manifest file.`, Example: ` # Build the given manifests directory into an artifact flux build artifact --path ./path/to/local/manifests --output ./path/to/artifact.tgz + # Build the given single manifest file into an artifact + flux build artifact --path ./path/to/local/manifest.yaml --output ./path/to/artifact.tgz + # List the files bundled in the artifact tar -ztvf ./path/to/artifact.tgz `, @@ -63,8 +66,8 @@ func buildArtifactCmdRun(cmd *cobra.Command, args []string) error { return fmt.Errorf("invalid path %q", buildArtifactArgs.path) } - if fs, err := os.Stat(buildArtifactArgs.path); err != nil || !fs.IsDir() { - return fmt.Errorf("invalid path '%s', must point to an existing directory", buildArtifactArgs.path) + if _, err := os.Stat(buildArtifactArgs.path); err != nil { + return fmt.Errorf("invalid path '%s', must point to an existing directory or file", buildArtifactArgs.path) } logger.Actionf("building artifact from %s", buildArtifactArgs.path) diff --git a/cmd/flux/push_artifact.go b/cmd/flux/push_artifact.go index bc4e0e0d..1c2725e2 100644 --- a/cmd/flux/push_artifact.go +++ b/cmd/flux/push_artifact.go @@ -31,7 +31,7 @@ import ( var pushArtifactCmd = &cobra.Command{ Use: "artifact", Short: "Push artifact", - Long: `The push artifact command creates a tarball from the given directory and uploads the artifact to an OCI repository. + Long: `The push artifact command creates a tarball from the given directory or the single file and uploads the artifact to an OCI repository. The command can read the credentials from '~/.docker/config.json' but they can also be passed with --creds. It can also login to a supported provider with the --provider flag.`, Example: ` # Push manifests to GHCR using the short Git SHA as the OCI artifact tag echo $GITHUB_PAT | docker login ghcr.io --username flux --password-stdin @@ -40,6 +40,13 @@ The command can read the credentials from '~/.docker/config.json' but they can a --source="$(git config --get remote.origin.url)" \ --revision="$(git branch --show-current)/$(git rev-parse HEAD)" + # Push single manifest file to GHCR using the short Git SHA as the OCI artifact tag + echo $GITHUB_PAT | docker login ghcr.io --username flux --password-stdin + flux push artifact oci://ghcr.io/org/config/app:$(git rev-parse --short HEAD) \ + --path="./path/to/local/manifest.yaml" \ + --source="$(git config --get remote.origin.url)" \ + --revision="$(git branch --show-current)/$(git rev-parse HEAD)" + # Push manifests to Docker Hub using the Git tag as the OCI artifact tag echo $DOCKER_PAT | docker login --username flux --password-stdin flux push artifact oci://docker.io/org/app-config:$(git tag --points-at HEAD) \ @@ -117,8 +124,8 @@ func pushArtifactCmdRun(cmd *cobra.Command, args []string) error { return err } - if fs, err := os.Stat(pushArtifactArgs.path); err != nil || !fs.IsDir() { - return fmt.Errorf("invalid path %q", pushArtifactArgs.path) + if _, err := os.Stat(pushArtifactArgs.path); err != nil { + return fmt.Errorf("invalid path '%s', must point to an existing directory or file", buildArtifactArgs.path) } meta := oci.Metadata{ diff --git a/go.mod b/go.mod index 51a00698..fb5c1e08 100644 --- a/go.mod +++ b/go.mod @@ -14,7 +14,7 @@ require ( github.com/fluxcd/notification-controller/api v0.27.0 github.com/fluxcd/pkg/apis/meta v0.16.0 github.com/fluxcd/pkg/kustomize v0.7.0 - github.com/fluxcd/pkg/oci v0.9.0 + github.com/fluxcd/pkg/oci v0.12.0 github.com/fluxcd/pkg/runtime v0.18.0 github.com/fluxcd/pkg/sourceignore v0.2.0 github.com/fluxcd/pkg/ssa v0.19.0 @@ -33,7 +33,7 @@ require ( github.com/manifoldco/promptui v0.9.0 github.com/mattn/go-shellwords v1.0.12 github.com/olekukonko/tablewriter v0.0.5 - github.com/onsi/gomega v1.20.1 + github.com/onsi/gomega v1.20.2 github.com/spf13/cobra v1.5.0 github.com/spf13/pflag v1.0.5 github.com/theckman/yacspin v0.13.12 @@ -57,7 +57,7 @@ replace gopkg.in/yaml.v3 => gopkg.in/yaml.v3 v3.0.1 require ( cloud.google.com/go v0.99.0 // indirect - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.1.2 // indirect + github.com/Azure/azure-sdk-for-go/sdk/azcore v1.1.3 // indirect github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.1.0 // indirect github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0 // indirect github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 // indirect @@ -72,7 +72,7 @@ require ( github.com/MakeNowJust/heredoc v1.0.0 // indirect github.com/Microsoft/go-winio v0.5.2 // indirect github.com/acomagu/bufpipe v1.0.3 // indirect - github.com/aws/aws-sdk-go v1.44.84 // indirect + github.com/aws/aws-sdk-go v1.44.105 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/cespare/xxhash/v2 v2.1.2 // indirect github.com/chai2010/gettext-go v1.0.2 // indirect diff --git a/go.sum b/go.sum index a253c400..99aec23b 100644 --- a/go.sum +++ b/go.sum @@ -55,8 +55,8 @@ contrib.go.opencensus.io/exporter/stackdriver v0.13.4/go.mod h1:aXENhDJ1Y4lIg4EU dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= github.com/Antonboom/errname v0.1.5/go.mod h1:DugbBstvPFQbv/5uLcRRzfrNqKE9tVdVCqWCLp6Cifo= github.com/Antonboom/nilnil v0.1.0/go.mod h1:PhHLvRPSghY5Y7mX4TW+BHZQYo1A8flE5H20D3IPZBo= -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.1.2 h1:lneMk5qtUMulXa/eVxjVd+/bDYMEDIqYpLzLa2/EsNI= -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.1.2/go.mod h1:uGG2W01BaETf0Ozp+QxxKJdMBNRWPdstHG0Fmdwn1/U= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.1.3 h1:8LoU8N2lIUzkmstvwXvVfniMZlFbesfT2AmA1aqvRr8= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.1.3/go.mod h1:uGG2W01BaETf0Ozp+QxxKJdMBNRWPdstHG0Fmdwn1/U= github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.1.0 h1:QkAcEIAKbNL4KoFr4SathZPhDhF4mVwpBMFlYjyAqy8= github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.1.0/go.mod h1:bhXu1AjYL+wutSL/kpSq6s7733q2Rb0yuot9Zgfqa/0= github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0 h1:jp0dGvZ7ZK0mgqnTSClMxa5xuRL7NZgHameVYF6BurY= @@ -134,8 +134,8 @@ github.com/ashanbrown/makezero v0.0.0-20210520155254-b6261585ddde/go.mod h1:oG9D github.com/aws/aws-sdk-go v1.23.20/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= github.com/aws/aws-sdk-go v1.25.37/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= github.com/aws/aws-sdk-go v1.36.30/go.mod h1:hcU610XS61/+aQV88ixoOzUoG7v3b31pl2zKMmprdro= -github.com/aws/aws-sdk-go v1.44.84 h1:orGogGRrizQSqn3lBnaP/FQIcjPMLf9azDO0h+oTJr0= -github.com/aws/aws-sdk-go v1.44.84/go.mod h1:y4AeaBuwd2Lk+GepC1E9v0qOiTws0MIWAX4oIKwKHZo= +github.com/aws/aws-sdk-go v1.44.105 h1:UUwoD1PRKIj3ltrDUYTDQj5fOTK3XsnqolLpRTMmSEM= +github.com/aws/aws-sdk-go v1.44.105/go.mod h1:y4AeaBuwd2Lk+GepC1E9v0qOiTws0MIWAX4oIKwKHZo= github.com/benbjohnson/clock v1.1.0 h1:Q92kusRqC1XV2MjkWETPvjJVqKetz1OzxZB7mHJLju8= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= @@ -207,7 +207,7 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/denis-tingajkin/go-header v0.4.2/go.mod h1:eLRHAVXzE5atsKAnNRDB90WHCFFnBUn4RN0nRcs1LJA= github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= -github.com/distribution/distribution/v3 v3.0.0-20220822034424-3413bf8e14fd h1:jtncyJ6leoRxSuB7y1EkkES0nKuG0kM7arfABcZW9r0= +github.com/distribution/distribution/v3 v3.0.0-20220907155224-78b9c98c5c31 h1:AqcwAyaSEkILnr/bLybFnM2i/+EW67JJIRs/4dWmzxo= github.com/dnaeon/go-vcr v1.1.0 h1:ReYa/UBrRyQdant9B4fNHGoCNKw6qh6P0fsdGmZpR7c= github.com/docker/cli v20.10.17+incompatible h1:eO2KS7ZFeov5UJeaDmIs1NFEDRf32PaqRpvoEkKBy5M= github.com/docker/cli v20.10.17+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8= @@ -276,8 +276,8 @@ github.com/fluxcd/pkg/apis/meta v0.16.0 h1:6Mj9rB0TtvCeTe3IlQDc1i2DH75Oosea9yUqS github.com/fluxcd/pkg/apis/meta v0.16.0/go.mod h1:GrOVzWXiu22XjLNgLLe2EBYhQPqZetes5SIADb4bmHE= github.com/fluxcd/pkg/kustomize v0.7.0 h1:604rlpRZTWaOfzDZ1W93aHaFh9kn8/UMX/wzsjwIUQY= github.com/fluxcd/pkg/kustomize v0.7.0/go.mod h1:zJY3Z0+SX+zs+/A1F6fCT0JvUce265XnrpTtHnujXPo= -github.com/fluxcd/pkg/oci v0.9.0 h1:ywS1rp8AV/N4UDVFYQK4qYfrADATPiWA3leXjG/eeK4= -github.com/fluxcd/pkg/oci v0.9.0/go.mod h1:L+TiQRy92wdqwb2LuScl7T1M24S7IgnzgjBD3iqoKEE= +github.com/fluxcd/pkg/oci v0.12.0 h1:+0vCpjFERfpmSfMT+Quk29l7OI/SbxEwX+Dw+JcZYkM= +github.com/fluxcd/pkg/oci v0.12.0/go.mod h1:gsRwVj0gTwk9xF3PuPJQ4R+rv8UtT26Gi7r1XfyBw8A= github.com/fluxcd/pkg/runtime v0.18.0 h1:3naATapV1y65ZWlsXEfJt66zSQBkJwJ9o/e6gqAF//E= github.com/fluxcd/pkg/runtime v0.18.0/go.mod h1:JKTvOFOCz5Un9KxGcBL7Xjt0fcRa10ZItGB0XFv44AY= github.com/fluxcd/pkg/sourceignore v0.2.0 h1:ooNbIkfxqNB+KKiY4AU+/DxwzjIKIOWBRK1As5QFlug= @@ -557,6 +557,7 @@ github.com/hashicorp/go-version v1.2.1/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09 github.com/hashicorp/go.net v0.0.1/go.mod h1:hjKkEWcCURg++eb33jQU7oqQcI9XDCnUzHA0oac0k90= github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/hashicorp/golang-lru v0.5.4 h1:YDjusn29QI/Das2iO9M0BHnIbxPeyuCHsjMW+lJfyTc= github.com/hashicorp/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64= @@ -777,8 +778,8 @@ github.com/onsi/ginkgo/v2 v2.1.6 h1:Fx2POJZfKRQcM1pH49qSZiYeu319wji004qX+GDovrU= github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= github.com/onsi/gomega v1.16.0/go.mod h1:HnhC7FXeEQY45zxNK3PPoIUhzk/80Xly9PcubAlGdZY= -github.com/onsi/gomega v1.20.1 h1:PA/3qinGoukvymdIDV8pii6tiZgC8kbmJO6Z5+b002Q= -github.com/onsi/gomega v1.20.1/go.mod h1:DtrZpjmvpn2mPm4YWQa0/ALMDj9v4YxLgojwPeREyVo= +github.com/onsi/gomega v1.20.2 h1:8uQq0zMgLEfa0vRrrBgaJF2gyW9Da9BmfGV+OyUzfkY= +github.com/onsi/gomega v1.20.2/go.mod h1:iYAIXgPSaDHak0LCMA+AWBpIKBr8WZicMxnE8luStNc= github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= github.com/opencontainers/image-spec v1.0.3-0.20220114050600-8b9d41f48198 h1:+czc/J8SlhPKLOtVLMQc+xDCFBT73ZStMsRhSsUhsSg=