Skip to content

[jb] support testing of stable GW #17073

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

Merged
merged 1 commit into from
Mar 29, 2023
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
17 changes: 12 additions & 5 deletions .github/workflows/jetbrains-integration-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,18 +82,25 @@ jobs:
env:
DISPLAY: ':10'
LEEWAY_MAX_PROVENANCE_BUNDLE_SIZE: '8388608'
TEST_USE_LATEST: ${{ inputs.use_latest }}
run: |
export GATEWAY_LINK=$(jq -r '.inputs.secret_gateway_link' $GITHUB_EVENT_PATH)
export GITPOD_TEST_ACCESSTOKEN=$(jq -r '.inputs.secret_access_token' $GITHUB_EVENT_PATH)
export WS_ENDPOINT=$(jq -r '.inputs.secret_endpoint' $GITHUB_EVENT_PATH)

export LEEWAY_WORKSPACE_ROOT=$(pwd)

sudo mkdir -p /workspace/.gradle-latest
sudo chown -R $(whoami) /workspace

mkdir -p $HOME/.cache/pluginVerifier-latest
leeway run dev/jetbrains-test:test -Dversion=integration-test -DpublishToJBMarketplace=false
if [ $TEST_USE_LATEST = "false" ]; then
sudo mkdir -p /workspace/.gradle-stable
sudo chown -R $(whoami) /workspace
mkdir -p $HOME/.cache/pluginVerifier-stable
leeway run dev/jetbrains-test:test-stable -Dversion=integration-test -DpublishToJBMarketplace=false
else
sudo mkdir -p /workspace/.gradle-latest
sudo chown -R $(whoami) /workspace
mkdir -p $HOME/.cache/pluginVerifier-latest
leeway run dev/jetbrains-test:test-latest -Dversion=integration-test -DpublishToJBMarketplace=false
fi
- name: Move video
if: always()
run: |
Expand Down
20 changes: 13 additions & 7 deletions dev/jetbrains-test/BUILD.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
scripts:
- name: test
- name: test-stable
srcs:
- "test.sh"
deps:
- components/ide/jetbrains/gateway-plugin:publish-stable
workdir: origin
script: |
cp $COMPONENTS_IDE_JETBRAINS_GATEWAY_PLUGIN__PUBLISH_STABLE/build/distributions/gitpod-gateway.zip gitpod-gateway.zip
./test.sh
- name: test-latest
srcs:
- "test.sh"
deps:
- components/ide/jetbrains/gateway-plugin:publish-latest
workdir: origin
script: |
cp $COMPONENTS_IDE_JETBRAINS_GATEWAY_PLUGIN__PUBLISH_LATEST/build/distributions/gitpod-gateway.zip gitpod-gateway.zip
export GATEWAY_PLUGIN_PATH=$(pwd)/gitpod-gateway.zip
mkdir -p ~/.local/share/JetBrains/consentOptions/
echo -n "rsch.send.usage.stat:1.1:0:1644945193441" > ~/.local/share/JetBrains/consentOptions/accepted
mkdir -p ~/.config/JetBrains/JetBrainsClient/options
touch ~/.config/JetBrains/JetBrainsClient/options/ide.general.xml
./gradlew test
./test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ class IdeDownloader @JvmOverloads constructor(private val httpClient: OkHttpClie
}
}

fun downloadAndExtractLatestEap(ide: Ide, toDir: Path): Path {
val idePackage = downloadIde(ide, toDir)
fun downloadAndExtract(ide: Ide, toDir: Path, type: String): Path {
val idePackage = downloadIde(ide, toDir, type)
return extractIde(idePackage, toDir)
}

Expand All @@ -43,8 +43,8 @@ class IdeDownloader @JvmOverloads constructor(private val httpClient: OkHttpClie
}
}

private fun downloadIde(ide: Ide, toDir: Path): Path {
val ideDownloadLink = getIdeDownloadUrl(ide, httpClient)
private fun downloadIde(ide: Ide, toDir: Path, type: String): Path {
val ideDownloadLink = getIdeDownloadUrl(ide, httpClient, type)
val idePackageName = ideDownloadLink.substringAfterLast("/").removeSuffix("/")
val targetFile = toDir.resolve(idePackageName)
return downloadFile(ideDownloadLink, targetFile)
Expand All @@ -60,13 +60,13 @@ class IdeDownloader @JvmOverloads constructor(private val httpClient: OkHttpClie
}
}

private fun getIdeDownloadUrl(ide: Ide, httpClient: OkHttpClient): String {
private fun getIdeDownloadUrl(ide: Ide, httpClient: OkHttpClient, type: String): String {
return httpClient.newCall(
Request.Builder().url(
"https://data.services.jetbrains.com/products/releases".toHttpUrl()
.newBuilder()
.addQueryParameter("code", ide.feedsCode)
.addQueryParameter("type", "eap,rc,release")
.addQueryParameter("type", type)
.addQueryParameter("platform", getFeedsOsPropertyName())
.build()
).build()
Expand All @@ -84,4 +84,4 @@ class IdeDownloader @JvmOverloads constructor(private val httpClient: OkHttpClie
?.asString ?: error("no suitable ide found")
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,11 @@ class GatewayLauncherTest {
val client = OkHttpClient()
remoteRobot = RemoteRobot("http://localhost:8082", client)
val ideDownloader = IdeDownloader(client)

val useLatest = System.getenv("TEST_USE_LATEST")?.toBoolean() ?: false
val type = if (useLatest) "eap,rc,release" else "release"
gatewayProcess = IdeLauncher.launchIde(
ideDownloader.downloadAndExtractLatestEap(Ide.GATEWAY, tmpDir),
ideDownloader.downloadAndExtract(Ide.GATEWAY, tmpDir, type),
mapOf("robot-server.port" to 8082),
emptyList(),
listOf(
Expand All @@ -100,4 +103,4 @@ class GatewayLauncherTest {

fun RemoteRobot.isAvailable(): Boolean = runCatching {
callJs<Boolean>("true")
}.getOrDefault(false)
}.getOrDefault(false)
10 changes: 10 additions & 0 deletions dev/jetbrains-test/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env bash

GATEWAY_PLUGIN_PATH=$(pwd)/gitpod-gateway.zip
export GATEWAY_PLUGIN_PATH

mkdir -p ~/.local/share/JetBrains/consentOptions/
echo -n "rsch.send.usage.stat:1.1:0:1644945193441" > ~/.local/share/JetBrains/consentOptions/accepted
mkdir -p ~/.config/JetBrains/JetBrainsClient/options
touch ~/.config/JetBrains/JetBrainsClient/options/ide.general.xml
./gradlew test