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

[drone] Support creating pull request and push triggers #4

Open
jimsheldon opened this issue Mar 17, 2023 · 0 comments
Open

[drone] Support creating pull request and push triggers #4

jimsheldon opened this issue Mar 17, 2023 · 0 comments
Labels
drone Drone migration target enhancement New feature or request

Comments

@jimsheldon
Copy link
Contributor

jimsheldon commented Mar 17, 2023

When creating a pipeline in Harness CI, this automation needs to create Pull Request and Push triggers.

TODO: We should also be able to support Tag and Cron events, but those will be tracked in a separate issue.

Both triggers should ignore commits with the same skip logic as Drone. While only [CI SKIP] is in the documentation, Drone supports more patterns. I only tested variations on [SKIP CI], but we should probably support ***NO_CI*** and ***no_ci*** as well.

Also, it is unclear to me if these triggers require input sets. I was unable to get either trigger working without providing an input set.

Examples

Pull Request Trigger

I think Drone only supports Open, Reopen and Synchronize pull request actions, but we should verify.

trigger:
  name: Pull Request
  identifier: pullrequest
  enabled: true
  encryptedWebhookSecretIdentifier: ""
  description: ""
  tags: {}
  orgIdentifier: default
  projectIdentifier: example
  pipelineIdentifier: example
  source:
    type: Webhook
    spec:
      type: Github
      spec:
        type: PullRequest
        spec:
          connectorRef: account.Jim_Sheldon_GitHub
          autoAbortPreviousExecutions: false
          payloadConditions:
            - key: targetBranch
              operator: Equals
              value: main
            - key: <+trigger.payload.head_commit.message>
              operator: Regex
              value: ^(?!.*SKIP\ CI).*$
            - key: <+trigger.payload.head_commit.message>
              operator: Regex
              value: ^(?!.*CI\ SKIP).*$
            - key: <+trigger.payload.head_commit.message>
              operator: Regex
              value: ^(?!.*skip\ ci).*$
            - key: <+trigger.payload.head_commit.message>
              operator: Regex
              value: ^(?!.*ci\ skip).*$
          headerConditions: []
          repoName: jimsheldon/drone-sandbox
          actions:
            - Open
            - Reopen
            - Synchronize
  pipelineBranchName: <+trigger.branch>
  inputSetRefs:
    - inputs

Push Trigger

trigger:
  name: Push
  identifier: push
  enabled: true
  encryptedWebhookSecretIdentifier: ""
  description: ""
  tags: {}
  orgIdentifier: default
  projectIdentifier: example
  pipelineIdentifier: example
  source:
    type: Webhook
    spec:
      type: Github
      spec:
        type: Push
        spec:
          connectorRef: account.Jim_Sheldon_GitHub
          autoAbortPreviousExecutions: false
          payloadConditions:
            - key: targetBranch
              operator: Equals
              value: main
            - key: <+trigger.payload.head_commit.message>
              operator: Regex
              value: ^(?!.*\[SKIP\ CI\]).*$
            - key: <+trigger.payload.head_commit.message>
              operator: Regex
              value: ^(?!.*\[CI\ SKIP\]).*$
            - key: <+trigger.payload.head_commit.message>
              operator: Regex
              value: ^(?!.*\[skip\ ci\]).*$
            - key: <+trigger.payload.head_commit.message>
              operator: Regex
              value: ^(?!.*\[ci\ skip\]).*$
          headerConditions: []
          repoName: jimsheldon/drone-sandbox
          actions: []
  pipelineBranchName: <+trigger.branch>
  inputSetRefs:
    - inputs
@jimsheldon jimsheldon added drone Drone migration target enhancement New feature or request labels Mar 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
drone Drone migration target enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant