Skip to content

Commit

Permalink
OCI docs improvements
Browse files Browse the repository at this point in the history
Co-authored-by: Kingdon Barrett <kingdon@weave.works>
Co-authored-by: Sunny <darkowlzz@protonmail.com>
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
  • Loading branch information
3 people committed Aug 10, 2022
1 parent d4c5a13 commit 311a242
Show file tree
Hide file tree
Showing 15 changed files with 31 additions and 25 deletions.
10 changes: 8 additions & 2 deletions action/README.md
Expand Up @@ -97,12 +97,18 @@ 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: Generate manifests
run: |
kustomize build ./manifests/staging > ./deploy/app.yaml
- name: Login to GHCR
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Push manifests
run: |
flux push artifact $OCI_REPO:$(git rev-parse --short HEAD) \
Expand Down Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions cmd/flux/build_artifact.go
Expand Up @@ -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,
Expand All @@ -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)
}

Expand All @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions cmd/flux/create_secret_oci.go
Expand Up @@ -30,16 +30,16 @@ 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 \
--username=username \
--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,
Expand Down
2 changes: 1 addition & 1 deletion cmd/flux/create_source_oci.go
Expand Up @@ -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")
Expand Down
2 changes: 1 addition & 1 deletion cmd/flux/delete_source_oci.go
Expand Up @@ -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`,
Expand Down
2 changes: 1 addition & 1 deletion cmd/flux/get_source_oci.go
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion 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.
Expand Down
6 changes: 3 additions & 3 deletions cmd/flux/pull_artifact.go
Expand Up @@ -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,
}
Expand All @@ -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)
}

Expand Down
2 changes: 1 addition & 1 deletion 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.
Expand Down
6 changes: 3 additions & 3 deletions cmd/flux/push_artifact.go
Expand Up @@ -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 '<branch|tag>/<commit-sha>'")
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 '<branch|tag>/<commit-sha>'")
pushCmd.AddCommand(pushArtifactCmd)
}

Expand Down
2 changes: 1 addition & 1 deletion 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.
Expand Down
2 changes: 1 addition & 1 deletion 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.
Expand Down
2 changes: 1 addition & 1 deletion cmd/flux/suspend_source_oci.go
Expand Up @@ -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`,
Expand Down
2 changes: 1 addition & 1 deletion 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.
Expand Down
2 changes: 1 addition & 1 deletion cmd/flux/tag_artifact.go
Expand Up @@ -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)
}

Expand Down

0 comments on commit 311a242

Please sign in to comment.