@docupace/pipeline 1.0.46 → 1.0.47-monorepo.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.
@@ -0,0 +1,205 @@
1
+ import OpenAI from 'openai';
2
+ import z from 'zod';
3
+ import { zodResponseFormat } from 'openai/helpers/zod';
4
+ import fs from 'fs';
5
+ import path from 'path';
6
+ import inquirer from 'inquirer';
7
+ import { getMainPackage, getPackage, findJiraTicketId } from './util.js';
8
+ import { getPackageNames } from './package-util.js';
9
+ import { execSync } from 'child_process';
10
+
11
+ async function createChangesetDirectory() {
12
+ try {
13
+ // Use path.join to build a safe path to `.changeset`
14
+ const targetDir = path.join(process.cwd(), '.changeset');
15
+
16
+ // Create the directory recursively if it doesn't exist
17
+ await fs.promises.mkdir(targetDir, { recursive: true });
18
+ } catch (error) {
19
+ console.error('Error creating .changeset directory:', error);
20
+ }
21
+ }
22
+
23
+ /**
24
+ * Gets the current git branch name
25
+ */
26
+ async function getCurrentBranch() {
27
+ try {
28
+ const branchName = execSync('git branch --show-current', {
29
+ encoding: 'utf8',
30
+ shell: true,
31
+ }).trim();
32
+ console.log(`Current branch: ${branchName}`);
33
+ return branchName;
34
+ } catch (error) {
35
+ console.error('Error getting current branch:', error.message);
36
+ throw error;
37
+ }
38
+ }
39
+ /**
40
+ * Extracts a Jira ticket ID from a branch name
41
+ */
42
+ function extractJiraTicketId(branchName) {
43
+ const jiraTicketId = findJiraTicketId(branchName);
44
+ if (!jiraTicketId) {
45
+ throw new Error('No Jira ticket found in the branch name.');
46
+ }
47
+ return jiraTicketId;
48
+ }
49
+
50
+ /**
51
+ * Fetches Jira ticket data from Jira API
52
+ */
53
+ async function fetchJiraTicketData(jiraTicketId) {
54
+ const jiraBaseUrl = 'https://docupacellc.atlassian.net';
55
+ const jiraEmail = process.env.JIRA_API_EMAIL;
56
+ const jiraApiKey = process.env.JIRA_API_KEY;
57
+ const jiraFullApiKey = `${jiraEmail}:${jiraApiKey}`;
58
+ const jiraUrl = `${jiraBaseUrl}/rest/api/2/issue/${jiraTicketId}`;
59
+
60
+ const jiraResponse = await fetch(jiraUrl, {
61
+ headers: {
62
+ Authorization: `Basic ${Buffer.from(jiraFullApiKey).toString('base64')}`,
63
+ 'Content-Type': 'application/json',
64
+ },
65
+ });
66
+
67
+ if (!jiraResponse.ok) {
68
+ throw new Error(
69
+ `Failed to fetch Jira ticket ${jiraTicketId}. Status: ${jiraResponse.status}, Ticket URL: ${jiraUrl}`,
70
+ );
71
+ }
72
+
73
+ return await jiraResponse.json();
74
+ }
75
+
76
+ /**
77
+ * Generates release notes using OpenAI
78
+ */
79
+ async function generateReleaseNotes(jiraTicketData) {
80
+ const openaiClient = new OpenAI({
81
+ apiKey: process.env['OPENAI_API_KEY'],
82
+ });
83
+
84
+ const ChangeRequestSchema = z.object({
85
+ change_type: z.enum(['patch', 'minor']),
86
+ summary: z.string(),
87
+ jira_ticket_id: z.string(),
88
+ });
89
+
90
+ const openAiResponse = await openaiClient.chat.completions.create({
91
+ model: 'gpt-4o-mini',
92
+ messages: [
93
+ {
94
+ role: 'system',
95
+ content: `Process JSON from a Jira ticket to generate simple maximum 2 sentence release note for the ticket and determine the change type for bug it should be a patch for new feature it should be a minor change`,
96
+ },
97
+ {
98
+ role: 'user',
99
+ content: JSON.stringify(jiraTicketData),
100
+ },
101
+ ],
102
+ response_format: zodResponseFormat(ChangeRequestSchema, 'changeset_schema'),
103
+ temperature: 0,
104
+ });
105
+
106
+ const assistantResponse = openAiResponse.choices[0].message.content;
107
+ return JSON.parse(assistantResponse);
108
+ }
109
+
110
+ /**
111
+ * Writes the changeset file
112
+ */
113
+ async function writeChangesetFile(packages, jiraTicketId, changeType, summary) {
114
+ // Generate the YAML frontmatter for multiple packages
115
+ const packageEntries = packages
116
+ .map((pkg) => `'${pkg.name}': ${changeType}`)
117
+ .join('\n');
118
+
119
+ const changesetContent = `---
120
+ ${packageEntries}
121
+ ---
122
+
123
+ ${summary} [${jiraTicketId}]
124
+ `;
125
+ const changesetFile = `./.changeset/${jiraTicketId}.md`;
126
+
127
+ await createChangesetDirectory();
128
+ await fs.promises.writeFile(changesetFile, changesetContent);
129
+ console.log(`Created changeset file at ${changesetFile}`);
130
+ }
131
+
132
+ /**
133
+ * Main function to create a changeset
134
+ */
135
+
136
+ export async function createChangeset() {
137
+ const packages = getPackageNames();
138
+
139
+ if (packages.length > 1) {
140
+ const allPackages = packages;
141
+ const response = await inquirer.prompt([
142
+ {
143
+ type: 'checkbox',
144
+ name: 'packages',
145
+ message: 'Which packages do you want to generate changesets for?',
146
+ choices: allPackages.map((appPackage) => ({
147
+ name: appPackage.name,
148
+ value: appPackage.name,
149
+ })),
150
+ validate: (input) => {
151
+ if (input.length === 0) {
152
+ return 'Please select at least one package.';
153
+ }
154
+ return true;
155
+ },
156
+ },
157
+ ]);
158
+
159
+ const selectedPackages = allPackages.filter((appPackage) =>
160
+ response.packages.includes(appPackage.name),
161
+ );
162
+
163
+ // Get package contents for all selected packages
164
+ const selectedPackageContents = await Promise.all(
165
+ selectedPackages.map(async (selectedPackage) => {
166
+ return await getPackage(selectedPackage.path);
167
+ }),
168
+ );
169
+
170
+ await createChangesetForPackage(selectedPackageContents);
171
+ } else {
172
+ const mainPackage = await getMainPackage();
173
+ await createChangesetForPackage([mainPackage]);
174
+ }
175
+ }
176
+
177
+ export async function createChangesetForPackage(packages) {
178
+ try {
179
+ // Step 1: Get the current branch name
180
+ const branchName = await getCurrentBranch();
181
+
182
+ // Step 2: Extract Jira ticket number
183
+ const jiraTicketId = extractJiraTicketId(branchName);
184
+
185
+ // Step 3: Fetch Jira ticket data
186
+ const jiraTicketData = await fetchJiraTicketData(jiraTicketId);
187
+ const jiraSummary = jiraTicketData.fields.summary;
188
+ console.log(
189
+ `Generating release notes for ${jiraTicketId} - ${jiraSummary}`,
190
+ );
191
+
192
+ // Step 4: Generate release notes using OpenAI
193
+ const { change_type, summary } = await generateReleaseNotes(jiraTicketData);
194
+ console.log(`Change type: ${change_type}`);
195
+ console.log(`Release note: ${summary}`);
196
+
197
+ // Step 5: Create a changeset .md file for all packages
198
+ await writeChangesetFile(packages, jiraTicketId, change_type, summary);
199
+
200
+ console.log('Changeset created successfully!');
201
+ } catch (err) {
202
+ console.error(`Error: ${err.message}`);
203
+ process.exit(1);
204
+ }
205
+ }
@@ -0,0 +1,86 @@
1
+ import fs from 'fs';
2
+ import path from 'path';
3
+
4
+ export function getPackageNames(rootPath = '.') {
5
+ const appsDir = path.join(rootPath, 'apps');
6
+ const packagesDir = path.join(rootPath, 'packages');
7
+ const rootPackageJson = path.join(rootPath, 'package.json');
8
+
9
+ // Check if this is a monorepo (has apps and/or packages directories)
10
+ const hasAppsDir =
11
+ fs.existsSync(appsDir) && fs.statSync(appsDir).isDirectory();
12
+ const hasPackagesDir =
13
+ fs.existsSync(packagesDir) && fs.statSync(packagesDir).isDirectory();
14
+
15
+ if (hasAppsDir || hasPackagesDir) {
16
+ // This is a monorepo
17
+ const packages = [];
18
+
19
+ // Get packages from apps directory
20
+ if (hasAppsDir) {
21
+ const appsPackages = getPackagesFromDirectory(appsDir);
22
+ packages.push(...appsPackages);
23
+ }
24
+
25
+ // Get packages from packages directory
26
+ if (hasPackagesDir) {
27
+ const packagesPackages = getPackagesFromDirectory(packagesDir);
28
+ packages.push(...packagesPackages);
29
+ }
30
+
31
+ return packages;
32
+ } else {
33
+ // This is not a monorepo, return single package
34
+ if (fs.existsSync(rootPackageJson)) {
35
+ try {
36
+ const packageJson = JSON.parse(
37
+ fs.readFileSync(rootPackageJson, 'utf8'),
38
+ );
39
+ return packageJson.name
40
+ ? [{ name: packageJson.name, path: rootPath }]
41
+ : [];
42
+ } catch (error) {
43
+ console.error('Error reading root package.json:', error);
44
+ return [];
45
+ }
46
+ }
47
+ return [];
48
+ }
49
+ }
50
+
51
+ function getPackagesFromDirectory(dirPath) {
52
+ const packages = [];
53
+
54
+ try {
55
+ const items = fs.readdirSync(dirPath);
56
+
57
+ for (const item of items) {
58
+ const itemPath = path.join(dirPath, item);
59
+ const packageJsonPath = path.join(itemPath, 'package.json');
60
+
61
+ // Check if item is a directory and has package.json
62
+ if (
63
+ fs.statSync(itemPath).isDirectory() &&
64
+ fs.existsSync(packageJsonPath)
65
+ ) {
66
+ try {
67
+ const packageJson = JSON.parse(
68
+ fs.readFileSync(packageJsonPath, 'utf8'),
69
+ );
70
+ if (packageJson.name) {
71
+ packages.push({
72
+ name: packageJson.name,
73
+ path: itemPath,
74
+ });
75
+ }
76
+ } catch (error) {
77
+ console.error(`Error reading package.json in ${itemPath}:`, error);
78
+ }
79
+ }
80
+ }
81
+ } catch (error) {
82
+ console.error(`Error reading directory ${dirPath}:`, error);
83
+ }
84
+
85
+ return packages;
86
+ }
@@ -0,0 +1,43 @@
1
+ import path from 'path';
2
+ import fs from 'fs';
3
+
4
+ async function fileExists(filePath) {
5
+ try {
6
+ await fs.promises.access(filePath);
7
+ return true;
8
+ } catch {
9
+ return false;
10
+ }
11
+ }
12
+ export async function getMainPackage() {
13
+ const mainModulePath = process.cwd();
14
+ return getPackage(mainModulePath);
15
+ }
16
+
17
+ export async function getPackage(mainModulePath) {
18
+ if (mainModulePath) {
19
+ const packageJsonPath = path.join(mainModulePath, 'package.json');
20
+ if (await fileExists(packageJsonPath)) {
21
+ const fileContent = await fs.promises.readFile(packageJsonPath, 'utf-8');
22
+ const packageJson = JSON.parse(fileContent);
23
+ return packageJson;
24
+ }
25
+ }
26
+ throw new Error('Main package.json not found');
27
+ }
28
+
29
+ /**
30
+ * Locates and extracts a JIRA Ticket ID from a given string.
31
+ * <p>
32
+ * The JIRA Ticket ID is expected to follow the pattern of uppercase letters (at least two) followed by a hyphen and digits (e.g., DC-1234, INFP-9).
33
+ * @param str the string to search for a JIRA ticket ID
34
+ * @returns {JIRA-TicketID|null}
35
+ */
36
+ export function findJiraTicketId(str) {
37
+ if (!str) {
38
+ return null;
39
+ }
40
+ const regex = /([A-Z]{2,}-\d+)/;
41
+ const matches = str.match(regex);
42
+ return matches ? matches[0] : null;
43
+ }
@@ -1,7 +1,44 @@
1
1
  import fs from 'fs';
2
2
  import path from 'path';
3
+ import { $ } from 'zx';
3
4
 
4
- export async function validateChangesets(directoryPath) {
5
+ import { isMonoRepo, setGitInfo } from '../next/util.js';
6
+ import { versionStatus } from './version.js';
7
+
8
+ const CHANGESET_DIR = '.changeset';
9
+
10
+ function areArraysEqualIgnoringOrder(arr1, arr2) {
11
+ if (arr1.length !== arr2.length) return false;
12
+
13
+ const sortedA = [...arr1].sort();
14
+ const sortedB = [...arr2].sort();
15
+
16
+ return sortedA.every((element, index) => element === sortedB[index]);
17
+ }
18
+
19
+ export async function validateChangesets() {
20
+ if (isMonoRepo()) {
21
+ await setGitInfo();
22
+ const destBranch = process.env.BITBUCKET_PR_DESTINATION_BRANCH;
23
+ await $`git fetch origin ${destBranch}:${destBranch}`;
24
+ await versionStatus(destBranch);
25
+ /*const changedPackages = await getChangedPackages();
26
+ const releaseNames = releases.map((release) => release.name);
27
+ const changedPackageNames = changedPackages.map(
28
+ (changedPackage) => changedPackage.name,
29
+ );
30
+
31
+ if (!areArraysEqualIgnoringOrder(releaseNames, changedPackageNames)) {
32
+ throw new Error(
33
+ 'Changesets must be created for all packages created and for those that have those changed as dependencies',
34
+ );
35
+ }*/
36
+ } else {
37
+ await validateChangesetPath(path.resolve(process.cwd(), CHANGESET_DIR));
38
+ }
39
+ }
40
+
41
+ export async function validateChangesetPath(directoryPath) {
5
42
  try {
6
43
  // Step 1: Read the directory for md files excluding README.md
7
44
  const allFiles = fs.readdirSync(directoryPath);
@@ -0,0 +1,94 @@
1
+ import { setGitInfo } from '../next/util.js';
2
+ import { $ } from 'zx';
3
+ import fs from 'fs';
4
+ import { updateComponentVersion } from '../next/jira.js';
5
+ import { findJiraTicketId } from './util.js';
6
+
7
+ const changeSetPackage = `{
8
+ "name": "changeset-package",
9
+ "version": "1.0.0",
10
+ "description": "",
11
+ "scripts": {
12
+ },
13
+ "type": "module",
14
+ "keywords": [],
15
+ "author": "",
16
+ "license": "ISC",
17
+ "dependencies": {},
18
+ "devDependencies": {
19
+ "@changesets/cli": "^2.27.10"
20
+ }
21
+ }
22
+ `;
23
+
24
+ export async function versionStatus(sinceBranch) {
25
+ const outputPath = './changeset-output.json';
26
+
27
+ if (sinceBranch) {
28
+ await $`pnpm changeset status --output=${outputPath} --since=${sinceBranch}`;
29
+ } else {
30
+ await $`pnpm changeset status --output=${outputPath}`;
31
+ }
32
+
33
+ // Read the file and parse JSON
34
+ const jsonOutput = JSON.parse(await fs.promises.readFile(outputPath, 'utf8'));
35
+
36
+ await fs.promises.rm(outputPath);
37
+ return jsonOutput.releases;
38
+ }
39
+
40
+ export async function versionCommand(closeVersion = false) {
41
+ console.log('📦 Running Changeset versioning...');
42
+ await setGitInfo();
43
+ await $`mv package.json package.json.bak`;
44
+ await $`mv pnpm-lock.yaml pnpm-lock.yaml.bak`;
45
+ await fs.promises.writeFile('package.json', changeSetPackage);
46
+ await $`pnpm install`;
47
+ await $`rm package.json pnpm-lock.yaml`;
48
+ await $`mv package.json.bak package.json`;
49
+ await $`mv pnpm-lock.yaml.bak pnpm-lock.yaml`;
50
+ if (closeVersion) {
51
+ await $`pnpm changeset pre exit`;
52
+ }
53
+
54
+ try {
55
+ const releases = await versionStatus();
56
+
57
+ const { stdout } = await $`git symbolic-ref refs/remotes/origin/HEAD`;
58
+ const defaultBranch = stdout.trim().replace('refs/remotes/origin/', '');
59
+
60
+ await $`git fetch origin ${defaultBranch}`;
61
+
62
+ await $`pnpm changeset version`;
63
+
64
+ return releases;
65
+ } catch {
66
+ return [];
67
+ }
68
+ }
69
+
70
+ export async function updateJiraWithVersion(releases) {
71
+ const lastCommit = (await $`git log -1 --pretty=%B`).stdout.trim();
72
+ console.log(`Last commit '${lastCommit}' being processed to get Jira ticket`);
73
+
74
+ const jiraTicketId = findJiraTicketId(lastCommit);
75
+
76
+ // If we have all the necessary data, update the component version in Jira
77
+ if (jiraTicketId) {
78
+ for (const release of releases) {
79
+ try {
80
+ await updateComponentVersion(
81
+ jiraTicketId,
82
+ release.name,
83
+ release.newVersion,
84
+ );
85
+ } catch (error) {
86
+ console.error(
87
+ `Failed to update Jira component version: ${error.message}`,
88
+ );
89
+ }
90
+ }
91
+ }
92
+
93
+ console.log('✅ Changeset versioning complete.');
94
+ }
@@ -1,6 +1,5 @@
1
1
  import groovy.json.JsonSlurper
2
-
3
- import hudson.model.*;
2
+ import hudson.model.*
4
3
 
5
4
  def build = Thread.currentThread().executable
6
5
  def params = build.getEnvironment(listener)
package/src/next/cli.js CHANGED
@@ -7,25 +7,24 @@ import { publish } from './publish.js';
7
7
  import {
8
8
  deployAppWithTag,
9
9
  deployFromSite,
10
+ deployTemplate,
10
11
  getDefaultDeploySite,
11
12
  getDeployTag,
12
13
  } from './deploy.js';
13
- import { deployTemplate } from './deploy.js';
14
- import { copy } from './copy.js';
14
+ import { copy, copy2 } from './copy.js';
15
15
  import { vaultAddSiteData } from './vault.js';
16
16
  import { addApacheSite } from './apache.js';
17
17
  import { haproxySync } from './haproxy.js';
18
18
  import { connectClone } from './connect.js';
19
19
  import dotenv from 'dotenv';
20
+ import { $ } from 'zx';
21
+ import { deployConnect, deployCore } from './jenkins.js';
22
+ import { runPipeline } from './pipline.js';
20
23
 
21
24
  dotenv.config({ path: ['.env.pipeline.local', 'config/.env.pipeline.local'] });
22
25
 
23
26
  const program = new Command();
24
27
 
25
- import { $ } from 'zx';
26
- import { deployConnect, deployCore } from './jenkins.js';
27
- import { runPipeline } from './pipline.js';
28
-
29
28
  const GIT_SHA = (await $`git log --pretty=format:'%h' -n 1`).stdout.trim();
30
29
 
31
30
  program
@@ -106,10 +105,10 @@ program
106
105
  });
107
106
 
108
107
  program
109
- .command('deploy-template')
108
+ .command('deploy-template <tagPrefix>')
110
109
  .description('Deploy an application for a specific site')
111
- .action(async () => {
112
- const deployTag = await getDeployTag();
110
+ .action(async (tagPrefix) => {
111
+ const deployTag = await getDeployTag(tagPrefix);
113
112
  const { env, site } = await getDefaultDeploySite(deployTag);
114
113
  await deployTemplate(env, site, deployTag);
115
114
  });
@@ -132,6 +131,16 @@ program
132
131
  await deployAppWithTag(application, env, site, deployTag);
133
132
  });
134
133
 
134
+ program
135
+ .command('deploy-mono-app <tag> <application>')
136
+ .description('Deploy an application for a specific site')
137
+ .action(async (tag, application) => {
138
+ const deployTag = await getDeployTag(tag);
139
+ const version = 'v' + deployTag.split('@')[1];
140
+ const { env, site } = await getDefaultDeploySite(version);
141
+ await deployAppWithTag(application, env, site, version);
142
+ });
143
+
135
144
  program
136
145
  .command('deploy-core <env> <site>')
137
146
  .description('Deploy Core')
@@ -167,13 +176,14 @@ program
167
176
  program
168
177
  .command('copy')
169
178
  .description('Copy a Docker image between registries')
170
- .requiredOption('-a, --application <application>', 'Application name')
179
+ .requiredOption('-r, --repository <repository>', 'Repostory name')
171
180
  .requiredOption('-f, --from-env <fromEnv>', 'Source environment')
172
181
  .requiredOption('-t, --to-env <toEnv>', 'Target environment')
173
182
  .requiredOption('-g, --tag <tag>', 'Image tag')
183
+ .requiredOption('-a, --application <application>', 'Application name')
174
184
  .action(async (options) => {
175
- const { application, fromEnv, toEnv, tag } = options;
176
- await copy(application, fromEnv, toEnv, tag);
185
+ const { repository, fromEnv, toEnv, tag, application } = options;
186
+ await copy2(repository, fromEnv, toEnv, tag, application);
177
187
  });
178
188
 
179
189
  program
@@ -1,5 +1,9 @@
1
+ import semver from 'semver';
2
+
1
3
  export const environments = ['dev', 'qa', 'uat', 'stage', 'prod'];
2
4
 
5
+ const UI_MONO_VERSION = '1.4.0-alpha.0';
6
+
3
7
  export const environmentConfig = {
4
8
  dev: {
5
9
  newUrl: (site) => `https://${site}.dev.dpai.tech`,
@@ -36,15 +40,47 @@ export const environmentConfig = {
36
40
  export const appInfo = {
37
41
  'graphql-server': {
38
42
  repositoryName: 'docupace-graphql-server',
43
+ imageName: 'docupace-graphql-server',
39
44
  deployAttributes: [
40
45
  'image.tag',
41
46
  'graphqlServer.siteConfigRemoteBranch',
42
47
  'graphqlServer.standardConfigRemoteBranch',
43
48
  ],
44
49
  },
50
+ cc: {
51
+ repositoryName: 'docupace-ui-main',
52
+ imageName: 'cc-ui-app',
53
+ deployAttributes: ['image.tag'],
54
+ getAppRevision: (config) => {
55
+ const version = config.image.tag.slice(1);
56
+ return 'cc-ui-app@' + version;
57
+ },
58
+ },
45
59
  ui: {
46
60
  repositoryName: 'docupace-ui-main',
61
+ imageName: 'enterprise-ui-app',
47
62
  deployAttributes: ['image.tag'],
63
+ getAppRevision: (config) => {
64
+ const tag = config.image.tag;
65
+ const version = tag.startsWith('v') ? tag.slice(1) : tag;
66
+ if (semver.gt(version, UI_MONO_VERSION)) {
67
+ return 'enterprise-ui-app@' + version;
68
+ } else {
69
+ return tag;
70
+ }
71
+ },
72
+ updateConfigFunction: (config) => {
73
+ if (config.image.repository.endsWith('/docupace-ui-main')) {
74
+ const tag = config.image.tag;
75
+ const version = tag.startsWith('v') ? tag.slice(1) : tag;
76
+ if (semver.gt(version, UI_MONO_VERSION)) {
77
+ const parts = config.image.repository.split('/');
78
+ parts[2] = 'enterprise-ui-app';
79
+ config.image.repository = parts.join('/');
80
+ }
81
+ }
82
+ return config;
83
+ },
48
84
  },
49
85
  };
50
86
 
package/src/next/copy.js CHANGED
@@ -11,7 +11,7 @@ export async function copy(application, fromEnv, toEnv, tag) {
11
11
  const repositoryName = appInfo[application].repositoryName;
12
12
  const fromRegistry = `${jfRegistryUrl}/${repositoryName}-${fromEnv}-docker-local`;
13
13
  const toRegistry = `${jfRegistryUrl}/${repositoryName}-${toEnv}-docker-local`;
14
- const imageName = `${repositoryName}:${tag}`;
14
+ const imageName = `${appInfo[application].imageName}:${tag}`;
15
15
  const fromFullImageName = `${fromRegistry}/${imageName}`;
16
16
  const toFullImageName = `${toRegistry}/${imageName}`;
17
17
 
@@ -29,14 +29,20 @@ export async function copy(application, fromEnv, toEnv, tag) {
29
29
  await $`docker push ${toFullImageName}`;
30
30
  }
31
31
 
32
- export async function copy2(repositoryName, fromEnv, toEnv, tag) {
32
+ export async function copy2(
33
+ repositoryName,
34
+ fromEnv,
35
+ toEnv,
36
+ tag,
37
+ applicationName,
38
+ ) {
33
39
  console.log(
34
40
  `Copying repository ${repositoryName} from ${fromEnv} to ${toEnv} for tag ${tag}`,
35
41
  );
36
42
  const envInfo = getEnvInfo();
37
43
  const fromRegistry = `${jfRegistryUrl}/${repositoryName}-${fromEnv}-docker-local`;
38
44
  const toRegistry = `${jfRegistryUrl}/${repositoryName}-${toEnv}-docker-local`;
39
- const imageName = `${repositoryName}:${tag}`;
45
+ const imageName = `${applicationName ?? repositoryName}:${tag}`;
40
46
  const fromFullImageName = `${fromRegistry}/${imageName}`;
41
47
  const toFullImageName = `${toRegistry}/${imageName}`;
42
48