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

init-pants action does not respect pants_bin_name option #9

Open
clydebw opened this issue Oct 25, 2022 · 3 comments
Open

init-pants action does not respect pants_bin_name option #9

clydebw opened this issue Oct 25, 2022 · 3 comments

Comments

@clydebw
Copy link

clydebw commented Oct 25, 2022

I'm using the pants_bin_name option to point Pants to ./pants-bin. I've created my own pants script, which does two things:

  • Refreshes a token to access our private CodeArtifact Python package index.
  • Calls pants-bin, passing in all arguments that were provided to the pants script.

This allows us to keep CodeArtifact authenticated and use Pants in the standard way.

Right now I don't think the init-pants GitHub Action respects pants_bin_name option, and instead looks directly in ./pants, which prevents us from using the latest version of this GitHub Action. (I might be wrong here, I'm pretty new to Pants)

Does it make sense to change the behaviour of this GitHub Action to check what pants_bin_name is (or perhaps the version of Pants), instead of having a look inside the pants script itself? If there is a recommended approach, I'm quite happy to attempt this change myself!

@benjyw
Copy link
Contributor

benjyw commented Oct 25, 2022

Yep, looks like it uses ./pants as a hardcoded name.

Grepping pants_bin_name might be complicated? Config can come from a few different places (and anyway, you're not required to set that, it's just for help messages, you can still rename ./pants to whatever you like without setting that option).

So I'd recommend adding an input to the job that sets the script name. We'd welcome a PR!

@cognifloyd
Copy link
Member

Yeah, I think adding an input param to the action would be best here.
Probably pants-bin-name defaulting to ./pants.

Note that the action actually introspects the ./pants script to make sure it is new enough. So, if your pants-bin-name is a wrapper around the actual pants script, that might not work.

So, if you want to tackle this, please make sure to:

  • replace all occurrences of ./pants with something like ${{ inputs.pants-bin-name }}
  • make sure the pants script version check can still work somehow:

if ! grep 'PANTS_BOOTSTRAP_TOOLS' ./pants > /dev/null; then
echo "This action requires a newer ./pants script. Please update following https://www.pantsbuild.org/docs/installation"
exit 1
fi
PANTS_BOOTSTRAP_CACHE_KEY=$(PANTS_BOOTSTRAP_TOOLS=1 ./pants bootstrap-cache-key)

@cognifloyd
Copy link
Member

Note: the PANTS_BOOTSTRAP_TOOLS check was introduced in #6. You can review the discussion and linked PRs there to see what the purpose of this check is.

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

3 participants