haven-cypress-integration 1.1.3 → 1.2.1
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.
- package/README.md +22 -8
- package/bin/haven-cypress.js +8 -3
- package/index.js +19 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -64,19 +64,33 @@ npx haven-cypress run --automationIds=TC-AUTO-123,TC-AUTO-124
|
|
|
64
64
|
```
|
|
65
65
|
|
|
66
66
|
### ECR Image Organization
|
|
67
|
-
Images are organized in the `haven-test-images` ECR repository with product-based
|
|
67
|
+
Images are organized in the `haven-test-images` ECR repository with product-based versioning:
|
|
68
68
|
```
|
|
69
69
|
Repository: haven-test-images
|
|
70
|
-
├── BE-latest
|
|
71
|
-
├── BE-
|
|
72
|
-
├──
|
|
73
|
-
└──
|
|
70
|
+
├── BE-v1.0.123456 (latest with build number)
|
|
71
|
+
├── BE-v2.1.0 (semantic version)
|
|
72
|
+
├── payments-v1.0.789012
|
|
73
|
+
└── auth-v3.0.0
|
|
74
74
|
```
|
|
75
75
|
|
|
76
|
-
**Tag Format**: `{PRODUCT}-{VERSION}
|
|
76
|
+
**Tag Format**: `{PRODUCT}-{VERSION}`
|
|
77
77
|
- **Product**: Organizes images by product/team
|
|
78
|
-
- **Version**: `
|
|
79
|
-
|
|
78
|
+
- **Version**: Semantic versioning (e.g., `v2.1.0`) or build numbers (e.g., `v1.0.123456`)
|
|
79
|
+
|
|
80
|
+
### Versioning Examples
|
|
81
|
+
```bash
|
|
82
|
+
# Build with auto-generated build number
|
|
83
|
+
npx haven-cypress build --product=BE --push
|
|
84
|
+
→ ECR tag: BE-v1.0.123456
|
|
85
|
+
|
|
86
|
+
# Build with semantic version
|
|
87
|
+
npx haven-cypress build --product=BE --tag=v2.1.0 --push
|
|
88
|
+
→ ECR tag: BE-v2.1.0
|
|
89
|
+
|
|
90
|
+
# Build with custom build number (CI/CD)
|
|
91
|
+
BUILD_NUMBER=456 npx haven-cypress build --product=BE --push
|
|
92
|
+
→ ECR tag: BE-v1.0.456
|
|
93
|
+
```
|
|
80
94
|
|
|
81
95
|
## What's Included
|
|
82
96
|
|
package/bin/haven-cypress.js
CHANGED
|
@@ -22,10 +22,15 @@ Options:
|
|
|
22
22
|
--automationIds=ID1,ID2 Run specific test cases
|
|
23
23
|
|
|
24
24
|
Examples:
|
|
25
|
-
npx haven-cypress build --product=
|
|
26
|
-
npx haven-cypress build --product=
|
|
27
|
-
npx haven-cypress build --product=
|
|
25
|
+
npx haven-cypress build --product=BE
|
|
26
|
+
npx haven-cypress build --product=BE --push
|
|
27
|
+
npx haven-cypress build --product=BE --tag=v2.1.0 --push
|
|
28
28
|
npx haven-cypress run --automationIds=TC-AUTO-123,TC-AUTO-124
|
|
29
|
+
|
|
30
|
+
Versioning:
|
|
31
|
+
--tag=latest → ECR tag: BE-v1.0.{BUILD_NUMBER}
|
|
32
|
+
--tag=v2.1.0 → ECR tag: BE-v2.1.0
|
|
33
|
+
BUILD_NUMBER env → Custom build number (default: timestamp)
|
|
29
34
|
`);
|
|
30
35
|
process.exit(1);
|
|
31
36
|
}
|
package/index.js
CHANGED
|
@@ -151,8 +151,23 @@ class HavenCypressIntegration {
|
|
|
151
151
|
// ECR repository and image details
|
|
152
152
|
const ecrRepo = 'haven-test-images';
|
|
153
153
|
const ecrUri = `${accountId}.dkr.ecr.${region}.amazonaws.com/${ecrRepo}`;
|
|
154
|
-
|
|
155
|
-
|
|
154
|
+
|
|
155
|
+
// Extract version from local tag or use 'latest'
|
|
156
|
+
const localVersion = localTag.split(':')[1] || 'latest';
|
|
157
|
+
|
|
158
|
+
// Generate ECR tag with product and version
|
|
159
|
+
let ecrTag;
|
|
160
|
+
if (localVersion === 'latest') {
|
|
161
|
+
// For 'latest', use build number format: product-v1.0.BUILD_NUMBER
|
|
162
|
+
const buildNumber = process.env.BUILD_NUMBER || Date.now().toString().slice(-6);
|
|
163
|
+
ecrTag = `${product}-v1.0.${buildNumber}`;
|
|
164
|
+
} else {
|
|
165
|
+
// For custom versions, preserve semantic versioning exactly
|
|
166
|
+
// Ensure version starts with 'v' prefix for consistency
|
|
167
|
+
const versionTag = localVersion.startsWith('v') ? localVersion : `v${localVersion}`;
|
|
168
|
+
ecrTag = `${product}-${versionTag}`;
|
|
169
|
+
}
|
|
170
|
+
|
|
156
171
|
const fullEcrUri = `${ecrUri}:${ecrTag}`;
|
|
157
172
|
|
|
158
173
|
console.log(`🏷️ ECR tag: ${ecrTag}`);
|
|
@@ -172,7 +187,8 @@ class HavenCypressIntegration {
|
|
|
172
187
|
|
|
173
188
|
console.log(`✅ Image pushed successfully!`);
|
|
174
189
|
console.log(`📍 ECR URI: ${fullEcrUri}`);
|
|
175
|
-
console.log(`🗂️ Product
|
|
190
|
+
console.log(`🗂️ Product: ${product}`);
|
|
191
|
+
console.log(`🏷️ Version: ${ecrTag}`);
|
|
176
192
|
|
|
177
193
|
} catch (error) {
|
|
178
194
|
console.error(`❌ Failed to push to ECR: ${error.message}`);
|