Skip to content

Commit

Permalink
Add withLocalPreview
Browse files Browse the repository at this point in the history
  • Loading branch information
mads-hartmann committed Sep 20, 2022
1 parent 588876c commit 0779e13
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 19 deletions.
6 changes: 2 additions & 4 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,9 @@ Does this PR require updates to the documentation at www.gitpod.io/docs?
-->

## Werft options:
<!--
Optional annotations to add to the werft job.

* with-preview - whether to create a preview environment for this PR
-->
- [ ] /werft with-local-preview
If enabled this will build `install/preview`
- [ ] /werft with-preview
- [ ] /werft with-integration-tests=all
Valid options are `all`, `workspace`, `webapp`, `ide`
1 change: 1 addition & 0 deletions .werft/jobs/build/build-and-publish.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ export async function buildAndPublish(werft: Werft, jobConfig: JobConfig) {
REPLICATED_APP: process.env.REPLICATED_APP,
npmPublishTrigger: publishToNpm ? Date.now().toString() : "false",
jbMarketplacePublishTrigger: publishToJBMarketplace ? Date.now().toString() : "false",
withLocalPreview: jobConfig.withLocalPreview,
}).map(([key, value]) => `-D${key}=${value}`).join(" ");

const buildFlags = [
Expand Down
3 changes: 3 additions & 0 deletions .werft/jobs/build/job-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export interface JobConfig {
withSelfHostedPreview: boolean;
withObservability: boolean;
withPayment: boolean;
withLocalPreview: boolean;
workspaceFeatureFlags: string[];
previewEnvironment: PreviewEnvironmentConfig;
repository: Repository;
Expand Down Expand Up @@ -97,6 +98,7 @@ export function jobConfig(werft: Werft, context: any): JobConfig {
const withPayment = "with-payment" in buildConfig && !mainBuild;
const withObservability = "with-observability" in buildConfig && !mainBuild;
const withLargeVM = "with-large-vm" in buildConfig && !mainBuild;
const withLocalPreview = "with-local-preview" in buildConfig || mainBuild
const repository: Repository = {
owner: context.Repository.owner,
repo: context.Repository.repo,
Expand Down Expand Up @@ -148,6 +150,7 @@ export function jobConfig(werft: Werft, context: any): JobConfig {
withPayment,
withUpgradeTests,
withSelfHostedPreview,
withLocalPreview,
workspaceFeatureFlags,
withLargeVM,
};
Expand Down
36 changes: 36 additions & 0 deletions install/preview/BUILD.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
const packages = []

const withLocalPreview = args.withLocalPreview == "true"

if (withLocalPreview) {
const docker = {
"name": "docker",
"type": "docker",
"deps": [
"install/installer:app",
"install/preview/prettylog:app"
],
"argdeps": [
"imageRepoBase"
],
"srcs": [
"entrypoint.sh",
"manifests/*.yaml"
],
"config": {
"dockerfile": "leeway.Dockerfile",
"image": [`${args.imageRepoBase}/local-preview:${args.version}`]
}
}
packages.push(docker)
} else {
packages.push({
"name": "docker",
"type": "generic",
"config": {
"commands": [
["echo", "Skipping build of install/preview:docker as -DwithLocalPreview was not set to true"]
]
}
})
}
15 changes: 0 additions & 15 deletions install/preview/BUILD.yaml
Original file line number Diff line number Diff line change
@@ -1,15 +0,0 @@
packages:
- name: docker
type: docker
deps:
- install/installer:app
- install/preview/prettylog:app
argdeps:
- imageRepoBase
srcs:
- "entrypoint.sh"
- "manifests/*.yaml"
config:
dockerfile: leeway.Dockerfile
image:
- ${imageRepoBase}/local-preview:${version}

0 comments on commit 0779e13

Please sign in to comment.