-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[jb-gha] improve nightly script and update file structure (#20220)
* [jb-gha] draft nightly script and update file structure * Update GHA with draft script * Update summary * Run leeway build * Fix build and share slack notification * Add force use dev latest images leeway script
- Loading branch information
1 parent
eb279a9
commit 4b05e71
Showing
11 changed files
with
452 additions
and
217 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
scripts: | ||
- name: jb-use-dev-latest | ||
script: | | ||
ide_list=("intellij" "goland" "pycharm" "phpstorm" "rubymine" "webstorm" "rider" "clion" "rustrover") | ||
prop_list=("latestImage") | ||
cf_patch=$(kubectl get cm ide-config -o=json | jq '.data."config.json"' |jq -r) | ||
for ide in "${ide_list[@]}"; do | ||
for prop in "${prop_list[@]}"; do | ||
cf_patch=$(echo "$cf_patch" | jq ".ideOptions.options.$ide.$prop = \"eu.gcr.io/gitpod-dev-artifact/build/ide/$ide:latest\"") | ||
done | ||
done | ||
cf_patch=$(echo "$cf_patch" |jq tostring) | ||
cf_patch="{\"data\": {\"config.json\": $cf_patch}}" | ||
# echo "$cf_patch" | ||
kubectl patch cm ide-config --type=merge -p "$cf_patch" | ||
kubectl rollout restart deployment ide-service | ||
kubectl rollout restart deployment server |
16 changes: 16 additions & 0 deletions
16
components/ide/gha-update-image/config/jb-backend-plugin-versions.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
[ | ||
{ | ||
"image": "eu.gcr.io/gitpod-core-dev/build/ide/jb-backend-plugin:commit-d54058956db3274084249bdbc4f508ab111b8c51", | ||
"detail": { | ||
"pluginSinceBuild": "242.19533", | ||
"pluginUntilBuild":"242.*" | ||
} | ||
}, | ||
{ | ||
"image": "eu.gcr.io/gitpod-core-dev/build/ide/jb-backend-plugin:commit-d54058956db3274084249bdbc4f508ab111b8c51-latest", | ||
"detail": { | ||
"pluginSinceBuild": "242.19533", | ||
"pluginUntilBuild":"242.*" | ||
} | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
// Copyright (c) 2024 Gitpod GmbH. All rights reserved. | ||
// Licensed under the GNU Affero General Public License (AGPL). | ||
// See License.AGPL.txt in the project root for license information. | ||
|
||
// Update JetBrains latest editor images | ||
// | ||
// ``` | ||
// bun run index-jb-nightly.ts --task=<id> --productCode=<code> | ||
// ``` | ||
|
||
import { $ } from "bun"; | ||
import { appendGitHubOutput, pathToBackendPluginGradleLatest, readWorkspaceYaml } from "./lib/common"; | ||
import { maybeCompatible, parseGradleProperties, parseGradlePropertiesFromTaskConfig } from "./lib/jb-helper/jb-helper"; | ||
import { fetchProductReleases, ReleaseItem, releaseItemStr } from "./lib/jb-helper/jb-releases"; | ||
import { getTaskFromArgs } from "./lib/jb-helper/jb-gradle-task-config"; | ||
|
||
$.nothrow(); // git likes to respond with non-zero codes, but it is alright for us | ||
|
||
const task = getTaskFromArgs(true); | ||
|
||
if (task.id !== 1) { | ||
throw new Error(`Only task 1 is supported, got ${task.id}`); | ||
} | ||
|
||
console.log(`Updating nightly editor for ${task.productId} (${task.productType})`); | ||
|
||
const { parsedObj: parsedWorkspaceYaml } = await readWorkspaceYaml(); | ||
|
||
const downloadUrl = parsedWorkspaceYaml.defaultArgs[task.productId + "DownloadUrl"] as string; | ||
|
||
const latestGradle = parseGradleProperties(await Bun.file(pathToBackendPluginGradleLatest).text()); | ||
|
||
const platformVersionType = "build"; | ||
|
||
const releases = await fetchProductReleases({ productCode: task.productCode, productType: task.productType }); | ||
|
||
let maybeCompatibleRelease: ReleaseItem | undefined; | ||
for (const release of releases) { | ||
switch (platformVersionType) { | ||
case "build": { | ||
const ok = maybeCompatible(release, latestGradle); | ||
if (ok) { | ||
maybeCompatibleRelease = release; | ||
break; | ||
} else { | ||
console.error(`${releaseItemStr(release)} incompatible`); | ||
} | ||
} | ||
} | ||
if (maybeCompatibleRelease) { | ||
break; | ||
} | ||
} | ||
|
||
if (maybeCompatibleRelease) { | ||
console.log(`${releaseItemStr(maybeCompatibleRelease)} maybe compatible`); | ||
} | ||
|
||
const targetRelease = maybeCompatibleRelease || releases.find((e) => e.downloads.linux?.link === downloadUrl); | ||
|
||
if (!targetRelease) { | ||
throw new Error(`No compatible release found`); | ||
} | ||
|
||
console.log(`Preparing to use ${releaseItemStr(targetRelease)} as latest version for ${task.productId}`); | ||
|
||
const targetConfig = parseGradlePropertiesFromTaskConfig(task, targetRelease); | ||
|
||
// TODO: actually update nightly editor | ||
console.log( | ||
`Going to exec \`leeway build -Dversion=latest -DimageRepoBase=$imageRepoBase -DbuildNumber=${targetConfig.platformVersion} components/ide/jetbrains/image:${task.productId}-latest -DjbBackendVersion=${targetRelease.version}\``, | ||
); | ||
|
||
appendGitHubOutput(`buildNumber=${targetConfig.platformVersion}`); | ||
appendGitHubOutput(`image=${task.productId}`); | ||
appendGitHubOutput(`jbBackendVersion=${targetRelease.version}`); | ||
appendGitHubOutput(`editorSummary=${releaseItemStr(targetRelease)}`); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.