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

Profile replacement does not always work #5838

Open
briandealwis opened this issue May 13, 2021 · 1 comment
Open

Profile replacement does not always work #5838

briandealwis opened this issue May 13, 2021 · 1 comment
Labels
area/docs area/profiles kind/bug Something isn't working kind/documentation priority/p2 May take a couple of releases

Comments

@briandealwis
Copy link
Member

Our docs say:

Once a profile is activated, the specified build, test and deploy configuration in it will replace the build, test and deploy sections declared in the main section of skaffold.yaml.

This implies that a pipeline like the following:

build:
  artifacts:
  - image: example

profiles:
- name: example
  build: {}

applying the example profile should replace the build: sections, such that there are no artifacts to build. But it does not.

We should either fix this, or change the documentation to reflect the reality that we merge overlay the paths found in the profile:

for i := 0; i < profileT.NumField(); i++ {
name := profileT.Field(i).Name
merged := overlayProfileField(name, configV.FieldByName(name).Interface(), profileV.FieldByName(name).Interface())
mergedV.FieldByName(name).Set(reflect.ValueOf(merged))
}

@briandealwis briandealwis added kind/bug Something isn't working priority/p2 May take a couple of releases area/profiles labels May 13, 2021
@briantopping
Copy link
Contributor

The doc text now says the following:

Once a profile is activated, the specified build, test and deploy configuration in it will be laid onto, but won’t completely replace, the build, test and deploy sections declared in the main section of skaffold.yaml.

If the content in the profile was once "overlaid", it is now replacing. So the documentation has been changed to match this behavior as when this issue was written, but the behavior has seemingly changed again.

@aaron-prindle offered to try using a patch in this slack convo, that worked.

I can't advocate which way it ought to work due to lack of experience with Skaffold, but my preference would be for a merge instead of a replacement. As I said in that OP:

I could duplicate everything down (to the profile), but then it’s not DRY. I could create the content as a YAML anchor, but that’s wonky.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/docs area/profiles kind/bug Something isn't working kind/documentation priority/p2 May take a couple of releases
Projects
None yet
Development

No branches or pull requests

4 participants