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 tag triggers #7

Open
jimsheldon opened this issue Mar 17, 2023 · 1 comment
Open

[drone] Support creating tag triggers #7

jimsheldon opened this issue Mar 17, 2023 · 1 comment
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 Tag triggers.

Examples

Harness CI does not currently have built-in Tag triggers, but I successfully tested this workaround.

NOTE: We should verify this workaround with engineering. We could probably do something similar with payloadConditions.

Tag Trigger with pattern

trigger:
  name: Tag
  identifier: Tag
  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: []
          headerConditions: []
          jexlCondition: <+trigger.payload.ref> =~ "refs/tags/v.*"
          repoName: jimsheldon/drone-sandbox
          actions: []
  pipelineBranchName: <+trigger.branch>
  inputSetRefs:
    - inputs

Which should be the equivalent to this Drone YAML:

kind: pipeline
type: docker
name: default

trigger:
  ref:
  - refs/tags/v*

Tag Trigger

trigger:
  name: Tag
  identifier: Tag
  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: []
          headerConditions: []
          jexlCondition: <+trigger.payload.ref> =~ "refs/tags/.*"
          repoName: jimsheldon/drone-sandbox
          actions: []
  pipelineBranchName: <+trigger.branch>
  inputSetRefs:
    - inputs

Which should be the equivalent to this Drone YAML:

kind: pipeline
type: docker
name: default

trigger:
  event:
  - tag
@jimsheldon jimsheldon added enhancement New feature or request drone Drone migration target labels Mar 17, 2023
@jimsheldon
Copy link
Contributor Author

Depending on how the build was initiated, different variables are available. Documentation is here https://developer.harness.io/docs/continuous-integration/ci-technical-reference/built-in-cie-codebase-variables-reference#how-and-when-codebase-variables-get-resolved

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