@naturalcycles/backend-lib 5.16.0 → 5.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -46,8 +46,11 @@ async function createDeployInfo(backendCfg, overrideBranch) {
46
46
  else {
47
47
  let branchName = gitBranch;
48
48
  if (backendCfg.hashedBranches) {
49
- // todo: jira
50
- branchName = (0, nodejs_lib_1.md5)(gitBranch).slice(0, 10);
49
+ // Obfuscates the branch name by hashing it.
50
+ // If there are Jira issue names in the branch name, the first one found will be used as a prefix.
51
+ const jiraIssue = gitBranch.match(/([Dd][Ee][Vv]-\d+)/)?.[0];
52
+ const branchHash = (0, nodejs_lib_1.md5)(gitBranch).slice(0, 10);
53
+ branchName = [jiraIssue, branchHash].filter(Boolean).join('-');
51
54
  }
52
55
  gaeService = validateGAEServiceName([branchName, gaeService].join('--'));
53
56
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@naturalcycles/backend-lib",
3
- "version": "5.16.0",
3
+ "version": "5.17.0",
4
4
  "scripts": {
5
5
  "prepare": "husky",
6
6
  "build": "dev-lib build",
@@ -60,8 +60,11 @@ export async function createDeployInfo(
60
60
  let branchName = gitBranch
61
61
 
62
62
  if (backendCfg.hashedBranches) {
63
- // todo: jira
64
- branchName = md5(gitBranch).slice(0, 10)
63
+ // Obfuscates the branch name by hashing it.
64
+ // If there are Jira issue names in the branch name, the first one found will be used as a prefix.
65
+ const jiraIssue = gitBranch.match(/([Dd][Ee][Vv]-\d+)/)?.[0]
66
+ const branchHash = md5(gitBranch).slice(0, 10)
67
+ branchName = [jiraIssue, branchHash].filter(Boolean).join('-')
65
68
  }
66
69
 
67
70
  gaeService = validateGAEServiceName([branchName, gaeService].join('--'))