Skip to content

Commit feedcda

Browse files
nandajavarmaroboquat
authored andcommitted
[self-hosted-preview] Support version specification in preview
1 parent fccdaa3 commit feedcda

File tree

3 files changed

+24
-9
lines changed

3 files changed

+24
-9
lines changed

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ export interface JobConfig {
3434
workspaceFeatureFlags: string[];
3535
previewEnvironment: PreviewEnvironmentConfig;
3636
repository: Repository;
37+
replicatedVersion: string;
3738
observability: Observability;
3839
withLargeVM: boolean;
3940
}
@@ -85,6 +86,7 @@ export function jobConfig(werft: Werft, context: any): JobConfig {
8586
const replicatedChannel = buildConfig["channel"];
8687
const cluster = buildConfig["cluster"];
8788
const withSelfHostedPreview = "with-sh-preview" in buildConfig;
89+
const replicatedVersion = withSelfHostedPreview ? buildConfig["version"] : "";
8890
const publishToNpm = "publish-to-npm" in buildConfig || mainBuild;
8991
const publishToJBMarketplace = "publish-to-jb-marketplace" in buildConfig || mainBuild;
9092
const publishToKots = "publish-to-kots" in buildConfig || withSelfHostedPreview || mainBuild;
@@ -142,6 +144,7 @@ export function jobConfig(werft: Werft, context: any): JobConfig {
142144
publishToNpm,
143145
publishToKots,
144146
replicatedChannel,
147+
replicatedVersion,
145148
repository,
146149
retag,
147150
storage,

.werft/jobs/build/self-hosted-upgrade-tests.ts

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -56,17 +56,22 @@ export async function triggerUpgradeTests(werft: Werft, config: JobConfig, usern
5656

5757
werft.phase(upgradeConfig.phase, upgradeConfig.description);
5858

59-
annotation = `${annotation} -a cluster=${phase} -a updateGitHubStatus=gitpod-io/gitpod -a subdomain=${subdomain}-${upgradeConfig.cloud}`
59+
annotation = `${annotation} -a updateGitHubStatus=gitpod-io/gitpod -a subdomain=${subdomain}-${upgradeConfig.cloud} -a deps=external`
6060

6161
const testFile: string = `.werft/${phase}-installer-tests.yaml`;
6262

6363
try {
64-
exec(
64+
const ret = exec(
6565
`werft run --remote-job-path ${testFile} ${annotation} github`,
6666
{
6767
slice: upgradeConfig.phase,
6868
},
69-
).trim();
69+
)
70+
71+
const jobID = ret.stdout.trim()
72+
exec(
73+
`werft log result -d "Werft preview build for ${phase}" url "https://werft.gitpod-dev.com/job/${jobID}"`,
74+
);
7075

7176
werft.done(upgradeConfig.phase);
7277
} catch (err) {
@@ -80,10 +85,11 @@ export async function triggerUpgradeTests(werft: Werft, config: JobConfig, usern
8085

8186
export async function triggerSelfHostedPreview(werft: Werft, config: JobConfig, username: string) {
8287
const replicatedChannel = config.replicatedChannel || config.repository.branch;
88+
const version = config.replicatedVersion || "-"
8389
const cluster = config.cluster || "k3s";
84-
const formattedBranch = config.repository.branch.replace("/", "-").slice(0,11)
90+
const formattedBranch = config.repository.branch.replace("/", "-").slice(0,10)
8591
const phase = phases[cluster]
86-
const subdomain = `${formattedBranch}-${phase.cloud}`
92+
const subdomain = `${formattedBranch}y-${phase.cloud}`
8793

8894
const replicatedApp = process.env.REPLICATED_APP
8995

@@ -114,7 +120,7 @@ export async function triggerSelfHostedPreview(werft: Werft, config: JobConfig,
114120

115121
exec(`git config --global user.name "${username}"`);
116122

117-
annotation = `${annotation} -a channel=${replicatedChannel} -a preview=true -a runTests=false -a deps=external`;
123+
annotation = `${annotation} -a version=${version} -a channel=${replicatedChannel} -a preview=true -a skipTests=true -a deps=external`;
118124

119125
werft.phase("self-hosted-preview", `Create self-hosted preview in ${cluster}`);
120126

@@ -123,12 +129,18 @@ export async function triggerSelfHostedPreview(werft: Werft, config: JobConfig,
123129
const testFile: string = `.werft/${cluster}-installer-tests.yaml`;
124130

125131
try {
126-
exec(
132+
const ret = exec(
127133
`werft run --remote-job-path ${testFile} ${annotation} github ${licenseFlag}`,
128134
{
129135
slice: "self-hosted-preview"
130136
},
131-
).trim();
137+
)
138+
139+
const jobID = ret.stdout.trim()
140+
exec(
141+
`werft log result -d "Werft preview build for ${cluster} " url "https://werft.gitpod-dev.com/job/${jobID}"`,
142+
);
143+
132144

133145
werft.done("self-hosted-preview");
134146
} catch (err) {

install/tests/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ endif
226226

227227
KOTS_KONFIG := "./manifests/kots-config.yaml"
228228

229-
get-base-config: get-github-config
229+
get-base-config:
230230
export DOMAIN=${TF_VAR_domain} && \
231231
export PATCH=$$(cat ${config_patch}) || export PATCH="" && \
232232
envsubst < ${KOTS_KONFIG} > tmp_config.yml

0 commit comments

Comments
 (0)