Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package okteto for openSUSE:Factory checked in at 2023-11-09 21:34:40 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/okteto (Old) and /work/SRC/openSUSE:Factory/.okteto.new.17445 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "okteto" Thu Nov 9 21:34:40 2023 rev:63 rq:1124738 version:2.22.2 Changes: -------- --- /work/SRC/openSUSE:Factory/okteto/okteto.changes 2023-11-07 21:28:58.105280096 +0100 +++ /work/SRC/openSUSE:Factory/.okteto.new.17445/okteto.changes 2023-11-09 21:34:59.267977658 +0100 @@ -1,0 +2,15 @@ +Thu Nov 09 14:48:22 UTC 2023 - ka...@b1-systems.de + +- Update to version 2.22.2: + * Added OKTETO_GIT_BRANCH environment variable to remote + Dockerfile as argument to have it available in the commands + executed there (#4039) (#4040) + +------------------------------------------------------------------- +Wed Nov 08 19:35:34 UTC 2023 - ka...@b1-systems.de + +- Update to version 2.22.1: + * add feature flag to enable disable pull first approach (#4036) + (#4038) + +------------------------------------------------------------------- Old: ---- okteto-2.22.0.obscpio New: ---- okteto-2.22.2.obscpio ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ okteto.spec ++++++ --- /var/tmp/diff_new_pack.dBadhY/_old 2023-11-09 21:35:00.780033378 +0100 +++ /var/tmp/diff_new_pack.dBadhY/_new 2023-11-09 21:35:00.780033378 +0100 @@ -19,7 +19,7 @@ %define __arch_install_post export NO_BRP_STRIP_DEBUG=true Name: okteto -Version: 2.22.0 +Version: 2.22.2 Release: 0 Summary: Develop your applications directly in your Kubernetes Cluster License: Apache-2.0 ++++++ _service ++++++ --- /var/tmp/diff_new_pack.dBadhY/_old 2023-11-09 21:35:00.816034705 +0100 +++ /var/tmp/diff_new_pack.dBadhY/_new 2023-11-09 21:35:00.820034852 +0100 @@ -3,10 +3,10 @@ <param name="url">https://github.com/okteto/okteto</param> <param name="scm">git</param> <param name="exclude">.git</param> - <param name="revision">2.22.0</param> + <param name="revision">2.22.2</param> <param name="versionformat">@PARENT_TAG@</param> <param name="changesgenerate">enable</param> - <param name="match-tag">2.22.0</param> + <param name="match-tag">2.22.2</param> </service> <service name="set_version" mode="manual"> <param name="basename">okteto</param> ++++++ _servicedata ++++++ --- /var/tmp/diff_new_pack.dBadhY/_old 2023-11-09 21:35:00.840035589 +0100 +++ /var/tmp/diff_new_pack.dBadhY/_new 2023-11-09 21:35:00.844035737 +0100 @@ -1,6 +1,6 @@ <servicedata> <service name="tar_scm"> <param name="url">https://github.com/okteto/okteto</param> - <param name="changesrevision">d0831eb5835883fe6528506d9159fe83949e047d</param></service></servicedata> + <param name="changesrevision">7fcce15f2b3853c65cb666ba936e66c05b0e0a29</param></service></servicedata> (No newline at EOF) ++++++ okteto-2.22.0.obscpio -> okteto-2.22.2.obscpio ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/okteto-2.22.0/cmd/build/v2/build.go new/okteto-2.22.2/cmd/build/v2/build.go --- old/okteto-2.22.0/cmd/build/v2/build.go 2023-11-03 17:24:26.000000000 +0100 +++ new/okteto-2.22.2/cmd/build/v2/build.go 2023-11-08 21:02:20.000000000 +0100 @@ -20,6 +20,7 @@ "errors" "fmt" "os" + "strconv" "strings" "sync" "time" @@ -65,6 +66,7 @@ IsOkteto() bool GetAnonymizedRepo() string GetBuildContextHash(*model.BuildInfo) string + IsSmartBuildsEnabled() bool } type analyticsTrackerInterface interface { @@ -105,12 +107,17 @@ oktetoLog.Infof("could not get working dir: %w", err) } gitRepo := repository.NewRepository(wd) + config := getConfig(registry, gitRepo) + + buildEnvs := map[string]string{} + buildEnvs[OktetoEnableSmartBuildEnvVar] = strconv.FormatBool(config.isSmartBuildsEnable) + return &OktetoBuilder{ Builder: builder, Registry: registry, V1Builder: buildv1.NewBuilder(builder, registry), - buildEnvironments: map[string]string{}, - Config: getConfig(registry, gitRepo), + buildEnvironments: buildEnvs, + Config: config, analyticsTracker: analyticsTracker, } } @@ -207,7 +214,7 @@ meta.BuildContextHashDuration = time.Since(buildContextHashDurationStart) // We only check that the image is built in the global registry if the noCache option is not set - if !options.NoCache && bc.Config.IsCleanProject() { + if !options.NoCache && bc.Config.IsCleanProject() && bc.Config.IsSmartBuildsEnabled() { imageChecker := getImageChecker(buildSvcInfo, bc.Config, bc.Registry) cacheHitDurationStart := time.Now() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/okteto-2.22.0/cmd/build/v2/config.go new/okteto-2.22.2/cmd/build/v2/config.go --- old/okteto-2.22.0/cmd/build/v2/config.go 2023-11-03 17:24:26.000000000 +0100 +++ new/okteto-2.22.2/cmd/build/v2/config.go 2023-11-08 21:02:20.000000000 +0100 @@ -14,12 +14,20 @@ package v2 import ( + "os" + "strconv" + oktetoLog "github.com/okteto/okteto/pkg/log" "github.com/okteto/okteto/pkg/model" "github.com/okteto/okteto/pkg/okteto" "github.com/spf13/afero" ) +const ( + // OktetoEnableSmartBuildEnvVar represents whether the feature flag to enable smart builds is enabled or not + OktetoEnableSmartBuildEnvVar = "OKTETO_SMART_BUILDS_ENABLED" +) + type configRepositoryInterface interface { GetSHA() (string, error) IsClean() (bool, error) @@ -32,11 +40,12 @@ } type oktetoBuilderConfig struct { - hasGlobalAccess bool - isCleanProject bool - repository configRepositoryInterface - fs afero.Fs - isOkteto bool + hasGlobalAccess bool + isCleanProject bool + repository configRepositoryInterface + fs afero.Fs + isOkteto bool + isSmartBuildsEnable bool } func getConfig(registry configRegistryInterface, gitRepo configRepositoryInterface) oktetoBuilderConfig { @@ -49,15 +58,33 @@ if err != nil { oktetoLog.Infof("error trying to get directory: %w", err) } + return oktetoBuilderConfig{ - repository: gitRepo, - hasGlobalAccess: hasAccess, - isCleanProject: isClean, - fs: afero.NewOsFs(), - isOkteto: okteto.Context().IsOkteto, + repository: gitRepo, + hasGlobalAccess: hasAccess, + isCleanProject: isClean, + fs: afero.NewOsFs(), + isOkteto: okteto.Context().IsOkteto, + isSmartBuildsEnable: getIsSmartBuildEnabled(), } } +func getIsSmartBuildEnabled() bool { + enableSmartBuilds := true + enableSmartBuildsStr := os.Getenv(OktetoEnableSmartBuildEnvVar) + if enableSmartBuildsStr != "" { + smartBuildEnabledBool, err := strconv.ParseBool(enableSmartBuildsStr) + if err != nil { + oktetoLog.Warning("feature flag %s received an invalid value; expected boolean. Smart builds will remain enabled by default", OktetoEnableSmartBuildEnvVar) + } else { + enableSmartBuilds = smartBuildEnabledBool + } + + } + + return enableSmartBuilds +} + // IsOkteto checks if the context is an okteto managed context func (oc oktetoBuilderConfig) IsOkteto() bool { return oc.isOkteto @@ -96,3 +123,7 @@ return getBuildHashFromGitHash(buildInfo, treeHash, "tree_hash") } + +func (oc oktetoBuilderConfig) IsSmartBuildsEnabled() bool { + return oc.isSmartBuildsEnable +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/okteto-2.22.0/cmd/build/v2/config_test.go new/okteto-2.22.2/cmd/build/v2/config_test.go --- old/okteto-2.22.0/cmd/build/v2/config_test.go 2023-11-03 17:24:26.000000000 +0100 +++ new/okteto-2.22.2/cmd/build/v2/config_test.go 2023-11-08 21:02:20.000000000 +0100 @@ -58,8 +58,9 @@ isClean: true, err: nil, }, - fs: afero.NewOsFs(), - isOkteto: true, + fs: afero.NewOsFs(), + isOkteto: true, + isSmartBuildsEnable: true, }, }, { @@ -81,8 +82,9 @@ isClean: true, err: nil, }, - fs: afero.NewOsFs(), - isOkteto: true, + fs: afero.NewOsFs(), + isOkteto: true, + isSmartBuildsEnable: true, }, }, { @@ -104,8 +106,9 @@ isClean: true, err: nil, }, - fs: afero.NewOsFs(), - isOkteto: true, + fs: afero.NewOsFs(), + isOkteto: true, + isSmartBuildsEnable: true, }, }, { @@ -127,8 +130,9 @@ isClean: false, err: assert.AnError, }, - fs: afero.NewOsFs(), - isOkteto: true, + fs: afero.NewOsFs(), + isOkteto: true, + isSmartBuildsEnable: true, }, }, } @@ -138,6 +142,37 @@ assert.Equal(t, tc.expected, cfg) }) } +} + +func TestGetIsSmartBuildEnabled(t *testing.T) { + tt := []struct { + name string + input string + expected bool + }{ + { + name: "enabled feature flag", + input: "true", + expected: true, + }, + { + name: "disabled feature flag", + input: "false", + expected: false, + }, + { + name: "wrong feature flag value default true", + input: "falsess", + expected: true, + }, + } + for _, tc := range tt { + t.Run(tc.name, func(t *testing.T) { + t.Setenv(OktetoEnableSmartBuildEnvVar, tc.input) + cfg := getIsSmartBuildEnabled() + assert.Equal(t, tc.expected, cfg) + }) + } } func TestGetGitCommit(t *testing.T) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/okteto-2.22.0/cmd/build/v2/services_test.go new/okteto-2.22.2/cmd/build/v2/services_test.go --- old/okteto-2.22.0/cmd/build/v2/services_test.go 2023-11-03 17:24:26.000000000 +0100 +++ new/okteto-2.22.2/cmd/build/v2/services_test.go 2023-11-08 21:02:20.000000000 +0100 @@ -215,11 +215,12 @@ } type fakeConfig struct { - isClean bool - hasAccess bool - sha string - isOkteto bool - repoURL string + isClean bool + hasAccess bool + sha string + isOkteto bool + repoURL string + isSmartBuildsEnable bool } func (fc fakeConfig) HasGlobalAccess() bool { return fc.hasAccess } @@ -228,3 +229,4 @@ func (fc fakeConfig) IsOkteto() bool { return fc.isOkteto } func (fc fakeConfig) GetAnonymizedRepo() string { return fc.repoURL } func (fc fakeConfig) GetBuildContextHash(*model.BuildInfo) string { return "" } +func (fc fakeConfig) IsSmartBuildsEnabled() bool { return fc.isSmartBuildsEnable } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/okteto-2.22.0/cmd/build/v2/tagger.go new/okteto-2.22.2/cmd/build/v2/tagger.go --- old/okteto-2.22.0/cmd/build/v2/tagger.go 2023-11-03 17:24:26.000000000 +0100 +++ new/okteto-2.22.2/cmd/build/v2/tagger.go 2023-11-08 21:02:20.000000000 +0100 @@ -69,7 +69,7 @@ // build the image reference based on context and buildInfo targetRegistry := constants.DevRegistry tag := "" - if i.cfg.HasGlobalAccess() && i.cfg.IsCleanProject() { + if i.cfg.HasGlobalAccess() && i.cfg.IsCleanProject() && i.cfg.IsSmartBuildsEnabled() { targetRegistry = constants.GlobalRegistry tag = buildHash } @@ -98,10 +98,15 @@ // getImageReferencesForTagWithDefaults returns all the possible image references for a given service, options include the given tag and the default okteto tag func (i imageTagger) getImageReferencesForTagWithDefaults(manifestName, svcToBuildName, tag string) []string { - imageReferencesWithTag := i.getImageReferencesForTag(manifestName, svcToBuildName, tag) - imageReferencesWithDefault := i.getImageReferencesForTag(manifestName, svcToBuildName, model.OktetoDefaultImageTag) - return append(imageReferencesWithTag, imageReferencesWithDefault...) + var imageReferences []string + if i.cfg.IsSmartBuildsEnabled() { + imageReferences = append(imageReferences, i.getImageReferencesForTag(manifestName, svcToBuildName, tag)...) + } + + imageReferences = append(imageReferences, i.getImageReferencesForTag(manifestName, svcToBuildName, model.OktetoDefaultImageTag)...) + + return imageReferences } // imageTaggerWithVolumes represent an imageTaggerInterface with an reference tag with volume mounts @@ -121,7 +126,7 @@ targetRegistry := constants.DevRegistry tag := "" - if i.cfg.HasGlobalAccess() && i.cfg.IsCleanProject() { + if i.cfg.HasGlobalAccess() && i.cfg.IsCleanProject() && i.cfg.IsSmartBuildsEnabled() { targetRegistry = constants.GlobalRegistry tag = buildHash } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/okteto-2.22.0/cmd/build/v2/tagger_test.go new/okteto-2.22.2/cmd/build/v2/tagger_test.go --- old/okteto-2.22.0/cmd/build/v2/tagger_test.go 2023-11-03 17:24:26.000000000 +0100 +++ new/okteto-2.22.2/cmd/build/v2/tagger_test.go 2023-11-08 21:02:20.000000000 +0100 @@ -126,11 +126,26 @@ expectedImage: "okteto.dev/test-test:okteto", }, { - name: "image inferred with clean project and has access to global registry", + name: "image inferred with clean project, has access to global registry but no feature flag enabled", cfg: fakeConfig{ - isClean: true, - hasAccess: true, - sha: "sha", + isClean: true, + hasAccess: true, + sha: "sha", + isSmartBuildsEnable: false, + }, + b: &model.BuildInfo{ + Dockerfile: "Dockerfile", + Context: ".", + }, + expectedImage: "okteto.dev/test-test:okteto", + }, + { + name: "image inferred with clean project, has access to global registry and feature flag enabled", + cfg: fakeConfig{ + isClean: true, + hasAccess: true, + sha: "sha", + isSmartBuildsEnable: true, }, b: &model.BuildInfo{ Dockerfile: "Dockerfile", @@ -182,7 +197,7 @@ expectedImage: "okteto.dev/test-test:okteto-with-volume-mounts", }, { - name: "image inferred with clean project and has access to global registry", + name: "image inferred with clean project, has access to global registry but no feature flag enabled", cfg: fakeConfig{ isClean: true, hasAccess: true, @@ -192,6 +207,20 @@ Dockerfile: "Dockerfile", Context: ".", }, + expectedImage: "okteto.dev/test-test:okteto-with-volume-mounts", + }, + { + name: "image inferred with clean project, has access to global registry and feature flag enabled", + cfg: fakeConfig{ + isClean: true, + hasAccess: true, + sha: "sha", + isSmartBuildsEnable: true, + }, + b: &model.BuildInfo{ + Dockerfile: "Dockerfile", + Context: ".", + }, expectedImage: "okteto.global/test-test:okteto-with-volume-mounts-b794839154e982d4df54fe7141aee87029f4099599a939b8ebd4a64d368b5c29", }, } @@ -262,9 +291,10 @@ func TestImageTaggerGetPossibleTags(t *testing.T) { tt := []struct { - name string - sha string - expectedImages []string + name string + sha string + expectedImages []string + isSmartBuildsEnabled bool }{ { name: "no sha", @@ -273,6 +303,7 @@ "okteto.dev/test-test:okteto", "okteto.global/test-test:okteto", }, + isSmartBuildsEnabled: true, }, { name: "sha", @@ -283,11 +314,21 @@ "okteto.dev/test-test:okteto", "okteto.global/test-test:okteto", }, + isSmartBuildsEnabled: true, + }, + { + name: "sha but smart builds not enabled", + sha: "sha", + expectedImages: []string{ + "okteto.dev/test-test:okteto", + "okteto.global/test-test:okteto", + }, + isSmartBuildsEnabled: false, }, } for _, tc := range tt { t.Run(tc.name, func(t *testing.T) { - tagger := newImageTagger(fakeConfig{}) + tagger := newImageTagger(fakeConfig{isSmartBuildsEnable: tc.isSmartBuildsEnabled}) assert.Equal(t, tc.expectedImages, tagger.getImageReferencesForTagWithDefaults("test", "test", tc.sha)) }) } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/okteto-2.22.0/cmd/deploy/remote.go new/okteto-2.22.2/cmd/deploy/remote.go --- old/okteto-2.22.0/cmd/deploy/remote.go 2023-11-03 17:24:26.000000000 +0100 +++ new/okteto-2.22.2/cmd/deploy/remote.go 2023-11-08 21:02:20.000000000 +0100 @@ -75,6 +75,7 @@ {{end}} ARG {{ .GitCommitArgName }} +ARG {{ .GitBranchArgName }} ARG {{ .InvalidateCacheArgName }} RUN okteto registrytoken install --force --log-output=json @@ -97,6 +98,7 @@ InternalServerName string ActionNameArgName string GitCommitArgName string + GitBranchArgName string InvalidateCacheArgName string DeployFlags string } @@ -189,6 +191,7 @@ fmt.Sprintf("%s=%s", constants.OktetoInternalServerNameEnvVar, sc.ServerName), fmt.Sprintf("%s=%s", model.OktetoActionNameEnvVar, os.Getenv(model.OktetoActionNameEnvVar)), fmt.Sprintf("%s=%s", constants.OktetoGitCommitEnvVar, os.Getenv(constants.OktetoGitCommitEnvVar)), + fmt.Sprintf("%s=%s", constants.OktetoGitBranchEnvVar, os.Getenv(constants.OktetoGitBranchEnvVar)), fmt.Sprintf("%s=%d", constants.OktetoInvalidateCacheEnvVar, int(randomNumber.Int64())), ) @@ -286,6 +289,7 @@ TokenArgName: model.OktetoTokenEnvVar, ActionNameArgName: model.OktetoActionNameEnvVar, GitCommitArgName: constants.OktetoGitCommitEnvVar, + GitBranchArgName: constants.OktetoGitBranchEnvVar, InvalidateCacheArgName: constants.OktetoInvalidateCacheEnvVar, DeployFlags: strings.Join(getDeployFlags(opts), " "), } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/okteto-2.22.0/cmd/deploy/remote_test.go new/okteto-2.22.2/cmd/deploy/remote_test.go --- old/okteto-2.22.0/cmd/deploy/remote_test.go 2023-11-03 17:24:26.000000000 +0100 +++ new/okteto-2.22.2/cmd/deploy/remote_test.go 2023-11-08 21:02:20.000000000 +0100 @@ -445,6 +445,7 @@ ARG OKTETO_GIT_COMMIT +ARG OKTETO_GIT_BRANCH ARG OKTETO_INVALIDATE_CACHE RUN okteto registrytoken install --force --log-output=json diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/okteto-2.22.0/cmd/destroy/remote.go new/okteto-2.22.2/cmd/destroy/remote.go --- old/okteto-2.22.0/cmd/destroy/remote.go 2023-11-03 17:24:26.000000000 +0100 +++ new/okteto-2.22.2/cmd/destroy/remote.go 2023-11-08 21:02:20.000000000 +0100 @@ -72,6 +72,7 @@ WORKDIR /okteto/src ARG {{ .GitCommitArgName }} +ARG {{ .GitBranchArgName }} ARG {{ .InvalidateCacheArgName }} RUN okteto registrytoken install --force --log-output=json @@ -93,6 +94,7 @@ InternalServerName string ActionNameArgName string GitCommitArgName string + GitBranchArgName string InvalidateCacheArgName string DestroyFlags string } @@ -193,6 +195,7 @@ fmt.Sprintf("%s=%s", constants.OktetoInternalServerNameEnvVar, sc.ServerName), fmt.Sprintf("%s=%s", model.OktetoActionNameEnvVar, os.Getenv(model.OktetoActionNameEnvVar)), fmt.Sprintf("%s=%s", constants.OktetoGitCommitEnvVar, os.Getenv(constants.OktetoGitCommitEnvVar)), + fmt.Sprintf("%s=%s", constants.OktetoGitBranchEnvVar, os.Getenv(constants.OktetoGitBranchEnvVar)), fmt.Sprintf("%s=%d", constants.OktetoInvalidateCacheEnvVar, int(randomNumber.Int64())), ) @@ -283,6 +286,7 @@ InternalServerName: constants.OktetoInternalServerNameEnvVar, ActionNameArgName: model.OktetoActionNameEnvVar, GitCommitArgName: constants.OktetoGitCommitEnvVar, + GitBranchArgName: constants.OktetoGitBranchEnvVar, InvalidateCacheArgName: constants.OktetoInvalidateCacheEnvVar, DestroyFlags: strings.Join(getDestroyFlags(opts), " "), } ++++++ okteto.obsinfo ++++++ --- /var/tmp/diff_new_pack.dBadhY/_old 2023-11-09 21:35:01.252050772 +0100 +++ /var/tmp/diff_new_pack.dBadhY/_new 2023-11-09 21:35:01.256050920 +0100 @@ -1,5 +1,5 @@ name: okteto -version: 2.22.0 -mtime: 1699028666 -commit: d0831eb5835883fe6528506d9159fe83949e047d +version: 2.22.2 +mtime: 1699473740 +commit: 7fcce15f2b3853c65cb666ba936e66c05b0e0a29 ++++++ vendor.tar.gz ++++++ /work/SRC/openSUSE:Factory/okteto/vendor.tar.gz /work/SRC/openSUSE:Factory/.okteto.new.17445/vendor.tar.gz differ: char 5, line 1