github-for-jira icon indicating copy to clipboard operation
github-for-jira copied to clipboard

Extend GitHub environment type mapping pattern with numbered names i.e. qa1 or uat2

Open tzieleniewski opened this issue 2 years ago • 2 comments

Howdy,

Currently the mapped environment type pattern is the following. ^(.*${separator})?(${exactMatch})(${separator}.*)?$ https://github.com/atlassian/github-for-jira/blob/main/src/transforms/transform-deployment.ts#L120 That catches names like uat-east, test:mary and etc.

There is one, quite a common case, which also affects our missed mappings, when environment names a suffixed with number. Few examples: dev1, qa1,qa3, stg2

Please consider introducing this small but significant improvement as having now unmapped envs is quite inconvenient and gives poor user experience.

All the best! Tomasz Krzysztof Zieleniewski

tzieleniewski avatar Jun 28 '22 07:06 tzieleniewski

Hey @tzieleniewski,

we just merged a feature where you can add a file called .jira/config.yml to your repository in which you can define different patterns for an environment mapping:

deployments:
  environmentMapping:
    development:
      - "dev*"
    staging:
      - "pre*"
    testing:
      - "qa*"
    production:
      - "prod*"

Also see the docs.

However, this feature is not rolled out to the public, yet. If you let me know your jira host name (*.atlassian.net) I can activate it earlier for you, if you want. Otherwise, it will probably become available over the next week or two for the general public.

thombergs avatar Aug 25 '22 03:08 thombergs

Hey @tzieleniewski,

we just merged a feature where you can add a file called .jira/config.yml to your repository in which you can define different patterns for an environment mapping:

deployments:
  environmentMapping:
    development:
      - "dev*"
    staging:
      - "pre*"
    testing:
      - "qa*"
    production:
      - "prod*"

Also see the docs.

However, this feature is not rolled out to the public, yet. If you let me know your jira host name (*.atlassian.net) I can activate it earlier for you, if you want. Otherwise, it will probably become available over the next week or two for the general public.

@thombergs is this already available to all?

cehenriques avatar Sep 19 '22 13:09 cehenriques

is there a way to test/debug this feature? We also added the config to the pipeline and we don't see changes

Develbold avatar Oct 04 '22 07:10 Develbold

Hey @cehenriques, yes this feature is live and available to all. Are you still having issues with this? @Develbold can you confirm that you have given permissions to the repo where you have added the config? Could you both send through want you have in your config.yml file? Here's an example if that helps https://github.com/rachellerathbone/sandbox/blob/main/.jira/config.yml

rachellerathbone avatar Oct 19 '22 04:10 rachellerathbone

As we haven't received a response in several months, I'm going to go ahead and close this issue. Please feel free to reopen if you would like further assistance.

rachellerathbone avatar Jan 17 '23 03:01 rachellerathbone

Hello @rachellerathbone, I am having some issues with the environment mapping feature. I would like to do a simple pattern matching so that all environments with _master suffixe are considered production environments. I followed the steps outline in the docs (here) and created .jira/config.yml with the following contents:

deployments:
  environmentMapping:
    development:
      - "*_dev"
    testing:
      - "*_test"
    staging:
      - "*_staging"
    production:
      - "*_master"

However, the mapping is ignored, e.g. deployments in 'deploy_master' still show up as unmapped in Jira. In principle the Github integration works as expected (e.g. a deployment in an environment named production will show up as a production release in Jira), it is just the mapping from the config which is ignored. Is there anything else I need to do for the mapping to be applied? Any help would be greatly appreciated!

nhoeft avatar Feb 20 '23 08:02 nhoeft

Same as @nhoeft for me, everything is setup correctly, still, jira does map the environment. @rachellerathbone can we maybe re-open this issue?

gabrielbull avatar Jun 17 '23 03:06 gabrielbull

Following up here -- it would seem the example configuration file provided by @rachellerathbone uses a different key in the yaml:

environment-mapping: versus environmentMapping as documented.

Which is the correct key? https://github.com/atlassian/github-for-jira/blob/fd190e83c22888a13a15f18c65843af42c4d3308/src/interfaces/common.ts#L97 makes it seem like the provided example linked above is wrong: https://github.com/rachellerathbone/sandbox/blob/e8fcc6a2147c6a1e418c3b631ce4defe56c76d6a/.jira/config.yml#L2 -- if nothing else, there are inconsistencies between the interface above, the provided example, and the documentation.

mbeacom avatar Aug 31 '23 17:08 mbeacom