feat: adds pre hook steps to config and tree builder#561
feat: adds pre hook steps to config and tree builder#561anuragrao04 wants to merge 1 commit intoterrateamio:mainfrom
Conversation
|
This is a change in semantics and I'm hesitant to merge it without some more deep thought. I know you're making use of what's available here, but I need to think through a bit what the right thing to do is. Is it really that you want access to the github token? |
|
Yep, this feature add is to just give access to TERRATEAM_GITHUB_TOKEN in config builder and tree builder. Tree builder often pulls terraform modules from other repos (a module repo) while doing the generation. In my use case, it runs terragrunt stack generate. The config builder also runs terragrunt stack generate to register generated dirs since the generated files are not carried over from tree builder to config builder. |
|
Here are two threads from the terrateam slack for extra context: |
This PR runs pre-hook steps in the config builder and tree builder, matching the pattern already used by plan and apply. On GitHub Actions this executes update_terrateam_github_token to populate TERRATEAM_GITHUB_TOKEN with a fresh app token before the builder script runs. On GitLab CI it's a no-op.
Previously, the builders called their scripts directly via cmd.run_with_output() without running any hooks, so the token step never executed and the builders only had access to the repo-scoped GitHub Actions token. This wires them into the same runtime.update_pre_hook_steps() + hooks.run_pre_hooks() path so they get the Terrateam app token like plan and apply do.