Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make local-preview optional #13093

Merged
merged 1 commit into from
Sep 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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}