@@ -3,32 +3,34 @@ import { Werft } from "../../util/werft";
3
3
import { previewNameFromBranchName } from "../../util/preview" ;
4
4
5
5
export interface JobConfig {
6
- analytics : string
6
+ analytics : string ;
7
7
buildConfig : any ;
8
- cleanSlateDeployment : boolean
9
- coverageOutput : string
8
+ cleanSlateDeployment : boolean ;
9
+ coverageOutput : string ;
10
10
dontTest : boolean ;
11
11
dynamicCPULimits : boolean ;
12
- installEELicense : boolean
13
- localAppVersion : string
12
+ installEELicense : boolean ;
13
+ localAppVersion : string ;
14
14
mainBuild : boolean ;
15
15
noPreview : boolean ;
16
16
publishRelease : boolean ;
17
- publishToJBMarketplace : string
18
- publishToNpm : string
17
+ publishToJBMarketplace : string ;
18
+ publishToNpm : string ;
19
19
publishToKots : boolean ;
20
- retag : string
20
+ retag : string ;
21
21
storage : string ;
22
22
version : string ;
23
- withContrib : boolean
23
+ withContrib : boolean ;
24
24
withIntegrationTests : boolean ;
25
- withObservability : boolean
26
- withPayment : boolean
27
- withVM : boolean
25
+ withUpgradeTests : boolean ;
26
+ fromVersion : string ;
27
+ withObservability : boolean ;
28
+ withPayment : boolean ;
29
+ withVM : boolean ;
28
30
workspaceFeatureFlags : string [ ] ;
29
- previewEnvironment : PreviewEnvironmentConfig ,
30
- repository : Repository
31
- observability : Observability
31
+ previewEnvironment : PreviewEnvironmentConfig ;
32
+ repository : Repository ;
33
+ observability : Observability ;
32
34
}
33
35
34
36
export interface PreviewEnvironmentConfig {
@@ -45,14 +47,14 @@ export interface Repository {
45
47
46
48
export interface Observability {
47
49
// The branch of gitpod-io/observability to use
48
- branch : string
50
+ branch : string ;
49
51
}
50
52
51
53
export function jobConfig ( werft : Werft , context : any ) : JobConfig {
52
- const sliceId = ' Parsing job configuration'
53
- werft . phase ( ' Job configuration' )
54
- werft . log ( sliceId , "Parsing the job configuration" )
55
- const version = parseVersion ( context )
54
+ const sliceId = " Parsing job configuration" ;
55
+ werft . phase ( " Job configuration" ) ;
56
+ werft . log ( sliceId , "Parsing the job configuration" ) ;
57
+ const version = parseVersion ( context ) ;
56
58
const repo = `${ context . Repository . host } /${ context . Repository . owner } /${ context . Repository . repo } ` ;
57
59
const mainBuild = repo === "github.com/gitpod-io/gitpod" && context . Repository . ref . includes ( "refs/heads/main" ) ;
58
60
@@ -64,7 +66,7 @@ export function jobConfig(werft: Werft, context: any): JobConfig {
64
66
if ( ! raw ) {
65
67
return [ ] ;
66
68
}
67
- return raw . split ( "," ) . map ( e => e . trim ( ) ) ;
69
+ return raw . split ( "," ) . map ( ( e ) => e . trim ( ) ) ;
68
70
} ) ( ) ;
69
71
70
72
const coverageOutput = exec ( "mktemp -d" , { silent : true } ) . stdout . trim ( ) ;
@@ -76,13 +78,15 @@ export function jobConfig(werft: Werft, context: any): JobConfig {
76
78
const noPreview = ( "no-preview" in buildConfig && buildConfig [ "no-preview" ] !== "false" ) || publishRelease ;
77
79
const storage = buildConfig [ "storage" ] || "" ;
78
80
const withIntegrationTests = "with-integration-tests" in buildConfig && ! mainBuild ;
81
+ const withUpgradeTests = "with-upgrade-tests" in buildConfig && ! mainBuild ;
82
+ const fromVersion = withUpgradeTests ? buildConfig [ "from-version" ] : "" ;
79
83
const publishToNpm = "publish-to-npm" in buildConfig || mainBuild ;
80
84
const publishToJBMarketplace = "publish-to-jb-marketplace" in buildConfig || mainBuild ;
81
85
const publishToKots = "publish-to-kots" in buildConfig ;
82
86
const analytics = buildConfig [ "analytics" ] ;
83
- const localAppVersion = mainBuild || ( "with-localapp-version" in buildConfig ) ? version : "unknown" ;
84
- const retag = ( "with-retag" in buildConfig ) ? "" : "--dont-retag" ;
85
- const cleanSlateDeployment = mainBuild || ( "with-clean-slate-deployment" in buildConfig ) ;
87
+ const localAppVersion = mainBuild || "with-localapp-version" in buildConfig ? version : "unknown" ;
88
+ const retag = "with-retag" in buildConfig ? "" : "--dont-retag" ;
89
+ const cleanSlateDeployment = mainBuild || "with-clean-slate-deployment" in buildConfig ;
86
90
const installEELicense = ! ( "without-ee-license" in buildConfig ) || mainBuild ;
87
91
const withPayment = "with-payment" in buildConfig && ! mainBuild ;
88
92
const withObservability = "with-observability" in buildConfig && ! mainBuild ;
@@ -91,24 +95,24 @@ export function jobConfig(werft: Werft, context: any): JobConfig {
91
95
repo : context . Repository . repo ,
92
96
ref : context . Repository . ref ,
93
97
branch : context . Repository . ref ,
94
- }
98
+ } ;
95
99
const refsPrefix = "refs/heads/" ;
96
100
if ( repository . branch . startsWith ( refsPrefix ) ) {
97
101
repository . branch = repository . branch . substring ( refsPrefix . length ) ;
98
102
}
99
103
const withoutVM = "without-vm" in buildConfig ;
100
104
const withVM = ! withoutVM || mainBuild ;
101
105
102
- const previewName = previewNameFromBranchName ( repository . branch )
106
+ const previewName = previewNameFromBranchName ( repository . branch ) ;
103
107
const previewEnvironmentNamespace = withVM ? `default` : `staging-${ previewName } ` ;
104
108
const previewEnvironment = {
105
109
destname : previewName ,
106
- namespace : previewEnvironmentNamespace
107
- }
110
+ namespace : previewEnvironmentNamespace ,
111
+ } ;
108
112
109
113
const observability : Observability = {
110
- branch : context . Annotations . withObservabilityBranch || "main"
111
- }
114
+ branch : context . Annotations . withObservabilityBranch || "main" ,
115
+ } ;
112
116
113
117
const jobConfig = {
114
118
analytics,
@@ -137,19 +141,21 @@ export function jobConfig(werft: Werft, context: any): JobConfig {
137
141
withPayment,
138
142
withVM,
139
143
workspaceFeatureFlags,
140
- }
144
+ } ;
141
145
142
146
werft . log ( "job config" , JSON . stringify ( jobConfig ) ) ;
143
- const globalAttributes = Object . fromEntries ( Object . entries ( jobConfig ) . map ( ( kv ) => {
144
- const [ key , value ] = kv
145
- return [ `werft.job.config.${ key } ` , value ]
146
- } ) )
147
- globalAttributes [ 'werft.job.config.branch' ] = context . Repository . ref
148
- werft . addAttributes ( globalAttributes )
147
+ const globalAttributes = Object . fromEntries (
148
+ Object . entries ( jobConfig ) . map ( ( kv ) => {
149
+ const [ key , value ] = kv ;
150
+ return [ `werft.job.config.${ key } ` , value ] ;
151
+ } ) ,
152
+ ) ;
153
+ globalAttributes [ "werft.job.config.branch" ] = context . Repository . ref ;
154
+ werft . addAttributes ( globalAttributes ) ;
149
155
150
- werft . done ( sliceId )
156
+ werft . done ( sliceId ) ;
151
157
152
- return jobConfig
158
+ return jobConfig ;
153
159
}
154
160
155
161
function parseVersion ( context : any ) {
@@ -163,5 +169,5 @@ function parseVersion(context: any) {
163
169
if ( version . substr ( 0 , PREFIX_TO_STRIP . length ) === PREFIX_TO_STRIP ) {
164
170
version = version . substr ( PREFIX_TO_STRIP . length ) ;
165
171
}
166
- return version
172
+ return version ;
167
173
}
0 commit comments