From 75a879c77030b8444b4b3f1a31b6f612f468e7ac Mon Sep 17 00:00:00 2001 From: Stefan Prodan Date: Wed, 10 Aug 2022 11:51:11 +0300 Subject: [PATCH] OCI docs improvements Co-authored-by: Kingdon Barrett Co-authored-by: Sunny Signed-off-by: Stefan Prodan --- action/README.md | 10 ++++++++-- cmd/flux/build_artifact.go | 8 ++++---- cmd/flux/create_secret_oci.go | 6 +++--- cmd/flux/create_source_oci.go | 2 +- cmd/flux/delete_source_oci.go | 2 +- cmd/flux/get_source_oci.go | 2 +- cmd/flux/list.go | 2 +- cmd/flux/pull_artifact.go | 6 +++--- cmd/flux/push.go | 2 +- cmd/flux/push_artifact.go | 6 +++--- cmd/flux/reconcile_source_oci.go | 2 +- cmd/flux/resume_source_oci.go | 2 +- cmd/flux/suspend_source_oci.go | 2 +- cmd/flux/tag.go | 2 +- cmd/flux/tag_artifact.go | 2 +- 15 files changed, 31 insertions(+), 25 deletions(-) diff --git a/action/README.md b/action/README.md index f2871b76..daeada31 100644 --- a/action/README.md +++ b/action/README.md @@ -97,9 +97,15 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Setup Flux CLI uses: fluxcd/flux2/action@main + - name: Login to GHCR + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} - name: Generate manifests run: | kustomize build ./manifests/staging > ./deploy/app.yaml @@ -132,7 +138,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Setup Flux CLI uses: fluxcd/flux2/action@main - name: Login to Docker Hub diff --git a/cmd/flux/build_artifact.go b/cmd/flux/build_artifact.go index a7db13f6..bf523fa0 100644 --- a/cmd/flux/build_artifact.go +++ b/cmd/flux/build_artifact.go @@ -28,11 +28,11 @@ import ( var buildArtifactCmd = &cobra.Command{ Use: "artifact", Short: "Build artifact", - Long: `The build artifact command creates an 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.`, Example: ` # Build the given manifests directory into an artifact flux build artifact --path ./path/to/local/manifests --output ./path/to/artifact.tgz - # List the files bundles in the artifact + # List the files bundled in the artifact tar -ztvf ./path/to/artifact.tgz `, RunE: buildArtifactCmdRun, @@ -47,7 +47,7 @@ var buildArtifactArgs buildArtifactFlags func init() { buildArtifactCmd.Flags().StringVar(&buildArtifactArgs.path, "path", "", "Path to the directory where the Kubernetes manifests are located.") - buildArtifactCmd.Flags().StringVarP(&buildArtifactArgs.output, "output", "0", "artifact.tgz", "Path to where the artifact tgz file should be written.") + buildArtifactCmd.Flags().StringVarP(&buildArtifactArgs.output, "output", "o", "artifact.tgz", "Path to where the artifact tgz file should be written.") buildCmd.AddCommand(buildArtifactCmd) } @@ -57,7 +57,7 @@ func buildArtifactCmdRun(cmd *cobra.Command, args []string) error { } if fs, err := os.Stat(buildArtifactArgs.path); err != nil || !fs.IsDir() { - return fmt.Errorf("invalid path %q", buildArtifactArgs.path) + return fmt.Errorf("invalid path '%s', must point to an existing directory", buildArtifactArgs.path) } logger.Actionf("building artifact from %s", buildArtifactArgs.path) diff --git a/cmd/flux/create_secret_oci.go b/cmd/flux/create_secret_oci.go index 2e86f461..b7cb3449 100644 --- a/cmd/flux/create_secret_oci.go +++ b/cmd/flux/create_secret_oci.go @@ -30,8 +30,8 @@ import ( var createSecretOCICmd = &cobra.Command{ Use: "oci [name]", - Short: "Create or update a Kubernetes secret for OCI Registry authentication", - Long: `The create secret oci command generates a Kubernetes secret with `, + Short: "Create or update a Kubernetes image pull secret", + Long: `The create secret oci command generates a Kubernetes secret that can be used for OCIRepository authentication`, Example: ` # Create an OCI authentication secret on disk and encrypt it with Mozilla SOPS flux create secret oci podinfo-auth \ --url=ghcr.io \ @@ -39,7 +39,7 @@ var createSecretOCICmd = &cobra.Command{ --password=password \ --export > repo-auth.yaml - sops --encrypt --encrypted-regex '^(data|stringData)$' \ + sops --encrypt --encrypted-regex '^(data|stringData)$' \ --in-place repo-auth.yaml `, RunE: createSecretOCICmdRun, diff --git a/cmd/flux/create_source_oci.go b/cmd/flux/create_source_oci.go index 2481fe7d..75372a35 100644 --- a/cmd/flux/create_source_oci.go +++ b/cmd/flux/create_source_oci.go @@ -71,7 +71,7 @@ func newSourceOCIFlags() sourceOCIRepositoryFlags { } func init() { - createSourceOCIRepositoryCmd.Flags().Var(&sourceOCIRepositoryArgs.provider, "provider", sourceBucketArgs.provider.Description()) + createSourceOCIRepositoryCmd.Flags().Var(&sourceOCIRepositoryArgs.provider, "provider", sourceOCIRepositoryArgs.provider.Description()) createSourceOCIRepositoryCmd.Flags().StringVar(&sourceOCIRepositoryArgs.url, "url", "", "the OCI repository URL") createSourceOCIRepositoryCmd.Flags().StringVar(&sourceOCIRepositoryArgs.tag, "tag", "", "the OCI artifact tag") createSourceOCIRepositoryCmd.Flags().StringVar(&sourceOCIRepositoryArgs.semver, "tag-semver", "", "the OCI artifact tag semver range") diff --git a/cmd/flux/delete_source_oci.go b/cmd/flux/delete_source_oci.go index 1d641bbf..8d98e5b0 100644 --- a/cmd/flux/delete_source_oci.go +++ b/cmd/flux/delete_source_oci.go @@ -24,7 +24,7 @@ import ( var deleteSourceOCIRepositoryCmd = &cobra.Command{ Use: "oci [name]", - Short: "Delete a OCIRepository source", + Short: "Delete an OCIRepository source", Long: "The delete source oci command deletes the given OCIRepository from the cluster.", Example: ` # Delete an OCIRepository flux delete source oci podinfo`, diff --git a/cmd/flux/get_source_oci.go b/cmd/flux/get_source_oci.go index 8f948d81..b79f73f8 100644 --- a/cmd/flux/get_source_oci.go +++ b/cmd/flux/get_source_oci.go @@ -34,7 +34,7 @@ var getSourceOCIRepositoryCmd = &cobra.Command{ Example: ` # List all OCIRepositories and their status flux get sources oci - # List OCIRepositories from all namespaces + # List OCIRepositories from all namespaces flux get sources oci --all-namespaces`, ValidArgsFunction: resourceNamesCompletionFunc(sourcev1.GroupVersion.WithKind(sourcev1.OCIRepositoryKind)), RunE: func(cmd *cobra.Command, args []string) error { diff --git a/cmd/flux/list.go b/cmd/flux/list.go index e89dc149..240e69d0 100644 --- a/cmd/flux/list.go +++ b/cmd/flux/list.go @@ -1,5 +1,5 @@ /* -Copyright 2021 The Flux authors +Copyright 2022 The Flux authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/cmd/flux/pull_artifact.go b/cmd/flux/pull_artifact.go index 7f508e53..f36ab3d0 100644 --- a/cmd/flux/pull_artifact.go +++ b/cmd/flux/pull_artifact.go @@ -31,8 +31,8 @@ var pullArtifactCmd = &cobra.Command{ Short: "Pull artifact", Long: `The pull artifact command downloads and extracts the OCI artifact content to the given path. The pull command uses the credentials from '~/.docker/config.json'.`, - Example: `# Pull an OCI artifact created by flux from GHCR -flux pull artifact oci://ghcr.io/org/manifests/app:v0.0.1 --output ./path/to/local/manifests + Example: ` # Pull an OCI artifact created by flux from GHCR + flux pull artifact oci://ghcr.io/org/manifests/app:v0.0.1 --output ./path/to/local/manifests `, RunE: pullArtifactCmdRun, } @@ -44,7 +44,7 @@ type pullArtifactFlags struct { var pullArtifactArgs pullArtifactFlags func init() { - pullArtifactCmd.Flags().StringVarP(&pullArtifactArgs.output, "output", "o", "", "Path where the artifact content should be extracted.") + pullArtifactCmd.Flags().StringVarP(&pullArtifactArgs.output, "output", "o", "", "path where the artifact content should be extracted.") pullCmd.AddCommand(pullArtifactCmd) } diff --git a/cmd/flux/push.go b/cmd/flux/push.go index 481c6ae9..eec4882d 100644 --- a/cmd/flux/push.go +++ b/cmd/flux/push.go @@ -1,5 +1,5 @@ /* -Copyright 2021 The Flux authors +Copyright 2022 The Flux authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/cmd/flux/push_artifact.go b/cmd/flux/push_artifact.go index 009ba437..6f318602 100644 --- a/cmd/flux/push_artifact.go +++ b/cmd/flux/push_artifact.go @@ -57,9 +57,9 @@ type pushArtifactFlags struct { var pushArtifactArgs pushArtifactFlags func init() { - pushArtifactCmd.Flags().StringVar(&pushArtifactArgs.path, "path", "", "Path to the directory where the Kubernetes manifests are located.") - pushArtifactCmd.Flags().StringVar(&pushArtifactArgs.source, "source", "", "The source address, e.g. the Git URL.") - pushArtifactCmd.Flags().StringVar(&pushArtifactArgs.revision, "revision", "", "The source revision in the format '/'") + pushArtifactCmd.Flags().StringVar(&pushArtifactArgs.path, "path", "", "path to the directory where the Kubernetes manifests are located") + pushArtifactCmd.Flags().StringVar(&pushArtifactArgs.source, "source", "", "the source address, e.g. the Git URL") + pushArtifactCmd.Flags().StringVar(&pushArtifactArgs.revision, "revision", "", "the source revision in the format '/'") pushCmd.AddCommand(pushArtifactCmd) } diff --git a/cmd/flux/reconcile_source_oci.go b/cmd/flux/reconcile_source_oci.go index 17df7174..ffc649f9 100644 --- a/cmd/flux/reconcile_source_oci.go +++ b/cmd/flux/reconcile_source_oci.go @@ -1,5 +1,5 @@ /* -Copyright 2020 The Flux authors +Copyright 2022 The Flux authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/cmd/flux/resume_source_oci.go b/cmd/flux/resume_source_oci.go index 42ad48ab..3c121c47 100644 --- a/cmd/flux/resume_source_oci.go +++ b/cmd/flux/resume_source_oci.go @@ -1,5 +1,5 @@ /* -Copyright 2020 The Flux authors +Copyright 2022 The Flux authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/cmd/flux/suspend_source_oci.go b/cmd/flux/suspend_source_oci.go index 06ab4c6c..d656dbf2 100644 --- a/cmd/flux/suspend_source_oci.go +++ b/cmd/flux/suspend_source_oci.go @@ -24,7 +24,7 @@ import ( var suspendSourceOCIRepositoryCmd = &cobra.Command{ Use: "oci [name]", - Short: "Suspend reconciliation of a OCIRepository", + Short: "Suspend reconciliation of an OCIRepository", Long: "The suspend command disables the reconciliation of an OCIRepository resource.", Example: ` # Suspend reconciliation for an existing OCIRepository flux suspend source oci podinfo`, diff --git a/cmd/flux/tag.go b/cmd/flux/tag.go index 56c9485f..966acef6 100644 --- a/cmd/flux/tag.go +++ b/cmd/flux/tag.go @@ -1,5 +1,5 @@ /* -Copyright 2021 The Flux authors +Copyright 2022 The Flux authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/cmd/flux/tag_artifact.go b/cmd/flux/tag_artifact.go index 4cfed851..65ba1218 100644 --- a/cmd/flux/tag_artifact.go +++ b/cmd/flux/tag_artifact.go @@ -43,7 +43,7 @@ type tagArtifactFlags struct { var tagArtifactArgs tagArtifactFlags func init() { - tagArtifactCmd.Flags().StringSliceVar(&tagArtifactArgs.tags, "tag", nil, "Tag name.") + tagArtifactCmd.Flags().StringSliceVar(&tagArtifactArgs.tags, "tag", nil, "tag name") tagCmd.AddCommand(tagArtifactCmd) }