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

Add support for post_get_sources_script, replace deprecated pre_clone_script with pre_get_sources_script #279

Merged
merged 3 commits into from
Sep 9, 2023

Conversation

fkleon
Copy link
Contributor

@fkleon fkleon commented Aug 15, 2023

  • Add support for post_get_sources_script in the runner config.
  • The pre_clone_script config option has been deprecated for a while now and is replaced by pre_get_sources_script.

See GitLab 16.2 docs: Advanced Configuration / The [[runners]] section

@guenhter
Copy link
Collaborator

LGTM.

@fkleon I think we should somehow manage old pre_clone_script variables in case people are not aware of this change. Maybe we just let this role fail in case the old variable is still defined... What do you think?

@riemers
Copy link
Owner

riemers commented Aug 15, 2023 via email

@fkleon
Copy link
Contributor Author

fkleon commented Aug 15, 2023

Thanks for reviewing this!

I thought about backwards-compatibility but wasn't sure what your preferred way of implementing this is.

There are a few options - and of course it also depends on the GitLab runner version the user decides to install (for which I believe there are no checks in this role yet).

  • Maintain backwards compatibility (at least until GitLab drops the field in question): Keep support for pre_clone_script and print a warning about use of a deprecated field.
  • Maintain backwards compatibility (longer term): Use the value of pre_clone_script to populate pre_get_sources_script internally and print a warning about use of a deprecated field.
  • Break backwards compatibility (loudly): Print a warning or fail the role if the deprecated field is used.
  • Break backwards compatibility (silently): As implemented; deprecated field will just be ignored.

@guenhter As a user of this Ansible role I'd probably prefer this to break loudly (instead of silently) together with a breaking change notice in the changelogs. I can add this to the MR if you're happy with that approach.

@guenhter
Copy link
Collaborator

I'm happy with every approach. If you just add one this is fine.

This allows to highlight upcoming deprecations to the user, or to fail
execution when deprecated/unsupported settings are used instead of
silently ignoring the setting.
@fkleon
Copy link
Contributor Author

fkleon commented Aug 24, 2023

Hi @guenhter and @riemers, I've added a commit that adds basic runner config validation via assert. For now the only setting that it picks up is the use of pre_clone_script. When this is detected, the execution fails with an appropriate error message telling the user to switch to the new variable name.

In the future that could be extended to perform additional validation; or to alert the user to upcoming deprecations.

@fkleon
Copy link
Contributor Author

fkleon commented Sep 6, 2023

@guenhter Just checking whether you've got any thoughts on this latest addition?

@guenhter
Copy link
Collaborator

guenhter commented Sep 7, 2023

For me it's fine. @riemers any objections?

@riemers
Copy link
Owner

riemers commented Sep 7, 2023

LGTM, if your good just merge it

@guenhter guenhter merged commit c6fce88 into riemers:master Sep 9, 2023
@guenhter
Copy link
Collaborator

guenhter commented Sep 9, 2023

@fkleon thanks for your contribution

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.

None yet

3 participants