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

'dependency_configuration' is undocumented and possibly has wrong default behaviour #1262

Open
ahuseby opened this issue Mar 8, 2024 · 3 comments

Comments

@ahuseby
Copy link

ahuseby commented Mar 8, 2024

Use of dependency_configuration is evidently supported, but lacks documentation in the Digger user documentation.
I'm not sure if #782 is supposed to address this.

Furthermore dependency_configuration could potetially have the wrong default behaviour, based on the definition of the two available modes (hard and soft).

// hard - even if dependency project wasn't changed, it will be executed
// soft - if dependency project wasn't changed, it will be skipped
const (
DependencyConfigurationHard = "hard"
DependencyConfigurationSoft = "soft"
)

My experience is that without specifying anything for dependency_configuration.mode, the following happens

We have 2 projects, A and B
B is dependent on A (using 'depends_on')

We want to make a change that only affects B

  1. If we commit a change that only affects B, nothing happens.
  2. If we then add a commit with change affecting A, then a plan run starts for A and B.

The way I observe this, in regards to adjusting dependency_configuration and how it currently functions

  • The hard (default) mode requires all projects in a dependency chain to become affected by change.
  • The soft mode will e.g. allow a change only to B. This is what we want.

However, the definition from the source code tell us the opposite.

// soft - if dependency project wasn't changed, it will be skipped

So seemingly the actual observed default behaviour is that of "soft", by definition.

Is the issue perhaps on this line in the orchestrator code?

if diggerConfig.DependencyConfiguration.Mode == digger_config.DependencyConfigurationHard {

Perhaps change the condition to diggerConfig.DependencyConfiguration.Mode == digger_config.DependencyConfigurationSoft?

I have discussed this with and demonstrated it on video call to @motatoes. In those discussions I've described a transitive dependency C -> B -> A, but that doesn't seem to matter at all. With the default behaviour, for C to plan, I have to make a change affecting A aswell.

@ahuseby
Copy link
Author

ahuseby commented Mar 8, 2024

I'm happy to contribute changes, but first need to clarify what the definition of DependencyConfiguration.Mode is and what the default behaviour is expected to be 🙂

@motatoes
Copy link
Contributor

motatoes commented Mar 8, 2024

I've discussed with @Spartakovic regarding this and he said that there might be a bug indeed with the "hard" behaviour and asked me to try and replace the line

to true might be the fix. Going to further investigate

@ahuseby
Copy link
Author

ahuseby commented Mar 11, 2024

Please let me know if you need someone to test this :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants