-
Notifications
You must be signed in to change notification settings - Fork 312
Add skipIfNoCache to tests #4612
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -159,9 +159,13 @@ type Params struct { | |
ExecutionEnvVars map[string]string | ||
Manifest *model.Manifest | ||
Command string | ||
TemplateName string | ||
DockerfileName string | ||
BaseImage string | ||
// CacheInvalidationKey is the value use to invalidate the cache. Defaults | ||
// to a random value which essentially means no-cache. Setting this to a | ||
// static or known value will reuse the build cache | ||
CacheInvalidationKey string | ||
TemplateName string | ||
DockerfileName string | ||
BaseImage string | ||
// ContextAbsolutePathOverride is the absolute path for the build context. Optional. | ||
// If this values is not defined it will default to the folder location of the | ||
// okteto manifest which is resolved through params.ManifestPathFlag | ||
|
@@ -186,8 +190,6 @@ type Params struct { | |
// UseOktetoDeployIgnoreFile if enabled loads the docker ignore file from an | ||
// .oktetodeployignore file. Disabled by default | ||
UseOktetoDeployIgnoreFile bool | ||
|
||
NoCache bool | ||
} | ||
|
||
// dockerfileTemplateProperties internal struct with the information needed by the Dockerfile template | ||
|
@@ -297,11 +299,15 @@ func (r *Runner) Run(ctx context.Context, params *Params) error { | |
return err | ||
} | ||
|
||
randomNumber, err := rand.Int(rand.Reader, big.NewInt(1000000)) | ||
if err != nil { | ||
return err | ||
cacheKey := params.CacheInvalidationKey | ||
if cacheKey == "" { | ||
|
||
randomNumber, err := rand.Int(rand.Reader, big.NewInt(1000000)) | ||
if err != nil { | ||
return err | ||
} | ||
cacheKey = strconv.Itoa(int(randomNumber.Int64())) | ||
} | ||
cacheKey := strconv.Itoa(int(randomNumber.Int64())) | ||
|
||
b, err := yaml.Marshal(params.Deployable) | ||
if err != nil { | ||
|
@@ -320,7 +326,7 @@ func (r *Runner) Run(ctx context.Context, params *Params) error { | |
outputMode = buildCmd.DeployOutputModeOnBuild | ||
} | ||
|
||
buildOptions := buildCmd.OptsFromBuildInfoForRemoteDeploy(buildInfo, &types.BuildOptions{OutputMode: outputMode, NoCache: params.NoCache}) | ||
buildOptions := buildCmd.OptsFromBuildInfoForRemoteDeploy(buildInfo, &types.BuildOptions{OutputMode: outputMode}) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the cache option was not passed to the remote, was this intentionally? we do not use cache for remote? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
https://github.com/okteto/okteto/blob/master/pkg/cmd/build/build.go#L327-L335 |
||
buildOptions.Manifest = params.Manifest | ||
buildOptions.BuildArgs = append( | ||
buildOptions.BuildArgs, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should include this field in the JSON schema. Ask @andreafalzetti if you need help to know how to do it