Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add digest source 'tag' to use tag without digest #5436

Merged
merged 2 commits into from
Mar 4, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cmd/skaffold/app/cmd/render.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func NewCmdRender() *cobra.Command {
{Value: &renderFromBuildOutputFile, Name: "build-artifacts", Shorthand: "a", Usage: "File containing build result from a previous 'skaffold build --file-output'"},
{Value: &offline, Name: "offline", DefValue: false, Usage: `Do not connect to Kubernetes API server for manifest creation and validation. This is helpful when no Kubernetes cluster is available (e.g. GitOps model). No metadata.namespace attribute is injected in this case - the manifest content does not get changed.`, IsEnum: true},
{Value: &renderOutputPath, Name: "output", DefValue: "", Usage: "file to write rendered manifests to"},
{Value: &opts.DigestSource, Name: "digest-source", DefValue: "local", Usage: "Set to 'local' to build images locally and use digests from built images; Set to 'remote' to resolve the digest of images by tag from the remote registry; Set to 'none' to use tags directly from the Kubernetes manifests", IsEnum: true},
{Value: &opts.DigestSource, Name: "digest-source", DefValue: "local", Usage: "Set to 'local' to build images locally and use digests from built images; Set to 'remote' to resolve the digest of images by tag from the remote registry; Set to 'none' to use tags directly from the Kubernetes manifests. Set to 'tag' to use tags directly from the build.", IsEnum: true},
}).
WithHouseKeepingMessages().
NoArgs(doRender)
Expand Down
2 changes: 1 addition & 1 deletion docs/content/en/docs/references/cli/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -826,7 +826,7 @@ Options:
--add-skaffold-labels=true: Add Skaffold-specific labels to rendered manifest. If false, custom labels are still applied. Helpful for GitOps model where Skaffold is not the deployer.
-a, --build-artifacts=: File containing build result from a previous 'skaffold build --file-output'
-d, --default-repo='': Default repository value (overrides global config)
--digest-source='local': Set to 'local' to build images locally and use digests from built images; Set to 'remote' to resolve the digest of images by tag from the remote registry; Set to 'none' to use tags directly from the Kubernetes manifests
--digest-source='local': Set to 'local' to build images locally and use digests from built images; Set to 'remote' to resolve the digest of images by tag from the remote registry; Set to 'none' to use tags directly from the Kubernetes manifests. Set to 'tag' to use tags directly from the build.
-f, --filename='skaffold.yaml': Path or URL to the Skaffold config file
-l, --label=[]: Add custom labels to deployed objects. Set multiple times for multiple labels
--loud=false: Show the build logs and output
Expand Down
5 changes: 3 additions & 2 deletions pkg/skaffold/runner/build_deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,9 @@ func (r *SkaffoldRunner) Build(ctx context.Context, out io.Writer, artifacts []*
return nil, err
}

// In dry-run mode or with --digest-source set to 'remote', we don't build anything, just return the tag for each artifact.
if r.runCtx.DryRun() || (r.runCtx.DigestSource() == remoteDigestSource) {
// In dry-run mode or with --digest-source set to 'remote' or 'tag', we don't build anything, just return the tag for each artifact.
if r.runCtx.DryRun() || (r.runCtx.DigestSource() == remoteDigestSource) ||
(r.runCtx.DigestSource() == tagDigestSource) {
var bRes []build.Artifact
for _, artifact := range artifacts {
bRes = append(bRes, build.Artifact{
Expand Down
1 change: 1 addition & 0 deletions pkg/skaffold/runner/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import (
const (
remoteDigestSource = "remote"
noneDigestSource = "none"
tagDigestSource = "tag"
)

// Runner is responsible for running the skaffold build, test and deploy config.
Expand Down