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

Post-workflow hooks not possible to configure for policy_check step #5123

Open
jlubins opened this issue Nov 27, 2024 · 0 comments
Open

Post-workflow hooks not possible to configure for policy_check step #5123

jlubins opened this issue Nov 27, 2024 · 0 comments
Labels
bug Something isn't working feature New functionality/enhancement

Comments

@jlubins
Copy link

jlubins commented Nov 27, 2024

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request. Searching for pre-existing feature requests helps us consolidate datapoints for identical requirements into a single place, thank you!
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request.
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment.

Overview of the Issue

My post-workfow hook does not run after the policy_check step.

I want to send custom metrics/events to Datadog after a policy_check Conftest run, which involves running a script to do so. This script needs access to $POLICYCHECKFILE to determine if there were any errors in the policy_check step.

Earlier, I had a post-workflow hook after the plan step, but I specifically need the policy_check output, as Conftest policies are overridden to pass on atlantis approve_policies, and I want to capture that when determining the time of a success for a particular PR.

Reproduction Steps

Add a post-workflow step and configure it to run on the policy_check command. See server-side config below.

Logs

Environment details

If not already included, please provide the following:

  • Atlantis version: v0.29.0
  • Deployment method: helm
  • If not running the latest Atlantis version have you tried to reproduce this issue on the latest version: No (no release notes related to it in later versions)
  • Atlantis flags: --enable-policy-checks

Atlantis server-side config file:
Relevant portions included:

repos:
      - id: /.*/
        apply_requirements: [approved, mergeable]
        workflow: conftest
        allowed_overrides: [workflow, policy_check]
        allow_custom_workflows: true
        delete_source_branch_on_merge: true
        pre_workflow_hooks:
          - run: /home/atlantis/scripts/get-conftest-policies.sh
            commands: plan
        post_workflow_hooks:
          - run: /home/atlantis/scripts/send-conftest-events.sh
            commands: policy_check
      workflows:
        conftest:
          plan:
            steps:
            - init
            - plan
            - show
            - run:
                command: |
                  cp $SHOWFILE /tmp/$BASE_REPO_NAME-$PULL_NUM-$PULL_AUTHOR.json
          policy_check:
            steps:
            - show
            - policy_check:
                extra_args: ["--update", "git::<redacted link>", "--namespace", "example-namespace"]
          apply:
            steps:
            - env:
                name: VAULT_TOKEN
                command: 'cat /vault/secrets/token'
            - apply

Repo atlantis.yaml file is not relevant, using default workflow defined in server-side config above.

Any other information you can provide about the environment/deployment (efs/nfs, aws/gcp, k8s/fargate, etc)
Running on EKS in AWS

Additional Context

n/a

@jlubins jlubins added the bug Something isn't working label Nov 27, 2024
@dosubot dosubot bot added the feature New functionality/enhancement label Nov 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working feature New functionality/enhancement
Projects
None yet
Development

No branches or pull requests

1 participant