diggerhq / digger

Digger is an open source IaC orchestration tool. Digger allows you to run IaC in your existing CI pipeline ⚡️
https://digger.dev
Apache License 2.0
3.64k stars 178 forks source link

Main branch (not PR branch) is used when Digger is triggered via comment directly #926

Open ZIJ opened 10 months ago

ZIJ commented 10 months ago

When Digger is triggered via comment directly and not via backend orchestrator, the version of the workflow file and digger.yml will not taken from the PR branch, but from the main branch instead.

This can lead to confusing behaviours. For example, user introduces digger.yml together with terraform in a single PR (common scenario). Plan works fine; but then they run digger apply it'd say "no projects impacted" because digger.yml is taken from the main branch.

Ideally the "direct trigger" mode without an orchestrator backend shouldn't be used at all but in reality people use it anyways, so we need to handle it better somehow.

Workarounds

Two options:

  1. Switch to triggering via Github App from the backend as per Quickstart. The guide is for using managed version at cloud.digger.dev but you can also self-host the orchestrator for free.
  2. Merge changes to workflow and digger.yml separately, before proceeding to running digger plan / digger apply. This will resolve the issue but obviously not convenient.
ZIJ commented 10 months ago

Tagging @frank-bee - this seems to be the root cause of the issue you're facing

frank-bee commented 10 months ago

@ZIJ thanks for your help What do you mean with "triggering via Github App"? The re is no word about that in the readme you referenced.

ZIJ commented 10 months ago

@frank-bee indeed I seem to have introduced confusion, apologies. And docs seem unclear on that, will update

To benefit from the GitHub app you can either use the cloud-based one at https://login.digger.dev/

Or self host the orchestrator: https://docs.digger.dev/self-host/deploy-binary

frank-bee commented 10 months ago

@ZIJ I installed the app, have a token in workflow as well. But you mean I have to have these triggers?

on:
  workflow_dispatch:
    inputs:
      id:
        description: 'run identifier'
        required: false
      job:
        required: true
frank-bee commented 10 months ago

I change the trigger: now on a PR the workflow is not triggered (but the digger app is installed)