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

remove fetch-includes early return #1365

Merged
merged 1 commit into from
Oct 28, 2024
Merged

Conversation

ekohilas
Copy link
Contributor

@ekohilas ekohilas commented Oct 6, 2024

I previously came across an issue where I was getting incorrect output due to cached files.

On realising this, I set the --fetch-includes flags, as it was documented that it would always fetch includes even when cached.

However when this flag was enabled, the program returned no output, and short-circuited all other flags.

This is because of the changes seen below, even though this flag value is used elsewhere to determine whether includes should be refetched.

While this is an api breaking change, if I understand the code correctly, it as an acceptable bug fix.

This is because the flag currently doesn't produce any output and only calls Parser.create.

However this PR would set it so that the flag does produce the correct output (which if I understand correctly won't make a difference as the user isn't checking for output) and all other code paths call Parser.create anyway.

If this change is not acceptable, the creation of a new flag would be required, along with changes to the rest of the code that uses fetchIncludes so that it performs as expected.

@ANGkeith
Copy link
Collaborator

ANGkeith commented Oct 6, 2024

i don't really see it as an bug, seemed like --fetch-includes was intentionally written to be a two step process

gcl --fetch-includes          # to force update the cache
gcl                           # re-run gcl using the updated cache

but i do like the behavior you're proposing as it sounds cleaner and more intuitive...

just like docker build vs docker build --no-cache

@ekohilas
Copy link
Contributor Author

ekohilas commented Oct 6, 2024

i don't really see it as an bug, seemed like --fetch-includes was intentionally written to be a two step process

gcl --fetch-includes          # to force update the cache
gcl                           # re-run gcl using the updated cache

Oh I see. If that's the case, that's fine, it should be better documented then so users can be aware that that is the case.

but i do like the behavior you're proposing as it sounds cleaner and more intuitive...

just like docker build vs docker build --no-cache

Yes, the other advantage is that if there was a certain configuration that was required (such as setting certain variables and options) then they need to be specified twice, in addition to having to re-process everything again.

@firecow
Copy link
Owner

firecow commented Oct 7, 2024

It definently was on purpose. "normally" programmers specify hardpinned include dependencies.
Only developers actively working on a module/include would use have to use --fetch-includes, because they utilize "master/latest/branches"

@ekohilas
Copy link
Contributor Author

ekohilas commented Oct 7, 2024

It definently was on purpose. "normally" programmers specify hardpinned include dependencies. Only developers actively working on a module/include would use have to use --fetch-includes, because they utilize "master/latest/branches"

Ah, thanks I see.

So what's the outcome of this?

  1. Should the PR be closed, and documentation updated such that scripts that want to always fetch includes instead run:
gitlab-ci-local --fetch-includes --variable VAR=test
gitlab-ci-local --variable VAR=test --list-json
  1. Should the PR be changed to add a new argument that bypasses the changes in the current PR but still sets the flag elsewhere?
  2. Rename the existing flag to be more specific?
  3. Something else?

@ANGkeith
Copy link
Collaborator

@firecow,
what do you think about this mr ?

seemed to be quite a popular behavior,

requested by #1371 too

@firecow
Copy link
Owner

firecow commented Oct 28, 2024

I'm ok with it.. 👍

@firecow firecow merged commit b9d4099 into firecow:master Oct 28, 2024
9 checks passed
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

Successfully merging this pull request may close these issues.

3 participants