Skip to content

Commit e1985ce

Browse files
mads-hartmannroboquat
authored andcommitted
Add withLocalPreview
1 parent b96d4cb commit e1985ce

File tree

5 files changed

+42
-19
lines changed

5 files changed

+42
-19
lines changed

.github/pull_request_template.md

+2-4
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,9 @@ Does this PR require updates to the documentation at www.gitpod.io/docs?
3030
-->
3131

3232
## Werft options:
33-
<!--
34-
Optional annotations to add to the werft job.
3533

36-
* with-preview - whether to create a preview environment for this PR
37-
-->
34+
- [ ] /werft with-local-preview
35+
If enabled this will build `install/preview`
3836
- [ ] /werft with-preview
3937
- [ ] /werft with-integration-tests=all
4038
Valid options are `all`, `workspace`, `webapp`, `ide`

.werft/jobs/build/build-and-publish.ts

+1
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ export async function buildAndPublish(werft: Werft, jobConfig: JobConfig) {
5656
REPLICATED_APP: process.env.REPLICATED_APP,
5757
npmPublishTrigger: publishToNpm ? Date.now().toString() : "false",
5858
jbMarketplacePublishTrigger: publishToJBMarketplace ? Date.now().toString() : "false",
59+
withLocalPreview: jobConfig.withLocalPreview,
5960
}).map(([key, value]) => `-D${key}=${value}`).join(" ");
6061

6162
const buildFlags = [

.werft/jobs/build/job-config.ts

+3
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ export interface JobConfig {
3030
withSelfHostedPreview: boolean;
3131
withObservability: boolean;
3232
withPayment: boolean;
33+
withLocalPreview: boolean;
3334
workspaceFeatureFlags: string[];
3435
previewEnvironment: PreviewEnvironmentConfig;
3536
repository: Repository;
@@ -97,6 +98,7 @@ export function jobConfig(werft: Werft, context: any): JobConfig {
9798
const withPayment = "with-payment" in buildConfig && !mainBuild;
9899
const withObservability = "with-observability" in buildConfig && !mainBuild;
99100
const withLargeVM = "with-large-vm" in buildConfig && !mainBuild;
101+
const withLocalPreview = "with-local-preview" in buildConfig || mainBuild
100102
const repository: Repository = {
101103
owner: context.Repository.owner,
102104
repo: context.Repository.repo,
@@ -148,6 +150,7 @@ export function jobConfig(werft: Werft, context: any): JobConfig {
148150
withPayment,
149151
withUpgradeTests,
150152
withSelfHostedPreview,
153+
withLocalPreview,
151154
workspaceFeatureFlags,
152155
withLargeVM,
153156
};

install/preview/BUILD.js

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
const packages = []
2+
3+
const withLocalPreview = args.withLocalPreview == "true"
4+
5+
if (withLocalPreview) {
6+
const docker = {
7+
"name": "docker",
8+
"type": "docker",
9+
"deps": [
10+
"install/installer:app",
11+
"install/preview/prettylog:app"
12+
],
13+
"argdeps": [
14+
"imageRepoBase"
15+
],
16+
"srcs": [
17+
"entrypoint.sh",
18+
"manifests/*.yaml"
19+
],
20+
"config": {
21+
"dockerfile": "leeway.Dockerfile",
22+
"image": [`${args.imageRepoBase}/local-preview:${args.version}`]
23+
}
24+
}
25+
packages.push(docker)
26+
} else {
27+
packages.push({
28+
"name": "docker",
29+
"type": "generic",
30+
"config": {
31+
"commands": [
32+
["echo", "Skipping build of install/preview:docker as -DwithLocalPreview was not set to true"]
33+
]
34+
}
35+
})
36+
}

install/preview/BUILD.yaml

-15
Original file line numberDiff line numberDiff line change
@@ -1,15 +0,0 @@
1-
packages:
2-
- name: docker
3-
type: docker
4-
deps:
5-
- install/installer:app
6-
- install/preview/prettylog:app
7-
argdeps:
8-
- imageRepoBase
9-
srcs:
10-
- "entrypoint.sh"
11-
- "manifests/*.yaml"
12-
config:
13-
dockerfile: leeway.Dockerfile
14-
image:
15-
- ${imageRepoBase}/local-preview:${version}

0 commit comments

Comments
 (0)