Skip to content
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
23 changes: 9 additions & 14 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ on:
jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 10
timeout-minutes: 5
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
Expand All @@ -42,18 +42,18 @@ jobs:
id: properties
shell: bash
run: |
PROPERTIES="$(./gradlew properties --console=plain -q)"
VERSION="$(echo "$PROPERTIES" | grep "^version:" | cut -f2- -d ' ')"
VERSION=$(grep "projectVersion" gradle.properties | cut -d'=' -f2)
echo "::set-output name=version::$VERSION"
echo "SPP_RELEASE_VERSION=${VERSION/-SNAPSHOT/}" >> $GITHUB_ENV
SPP_RELEASE_VERSION=${VERSION/-SNAPSHOT/}
echo "::set-output name=release_version::$SPP_RELEASE_VERSION"

- run: ./gradlew assembleUp -Dbuild.profile=release -PprobeVersion=$SPP_RELEASE_VERSION
- name: Start platform
run: ./gradlew assembleUp -Dbuild.profile=release -PprobeVersion=$SPP_RELEASE_VERSION

- name: Docker IPs
run: docker inspect --format='{{.Name}} - {{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $(docker ps -aq)

- name: Set E2E_APP_HOST
run: E2E_APP_HOST=$(docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $(docker ps -aqf "name=e2e-test")) && echo "E2E_APP_HOST=$E2E_APP_HOST" >> $GITHUB_ENV
- name: Set SPP_PLATFORM_HOST
run: SPP_PLATFORM_HOST=$(docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $(docker ps -aqf "name=spp-platform")) && echo "SPP_PLATFORM_HOST=$SPP_PLATFORM_HOST" >> $GITHUB_ENV
- name: Set SPP_JWT_TOKEN
Expand All @@ -63,15 +63,10 @@ jobs:
run: |
until $(curl --header "Authorization: Bearer ${{ env.SPP_JWT_TOKEN }}" --insecure --output /dev/null --silent --fail http://localhost:12800/health); do printf '.'; sleep 5; done

- name: Wait for probe
run: sleep 15s #todo: smarter waiting

- name: Verify probe connected
run: |
resp=$(curl --header "Authorization: Bearer ${{ env.SPP_JWT_TOKEN }}" --insecure http://localhost:12800/clients) && [[ $(echo $resp | jq -r ."probes"[0]."meta"."language") == "nodejs" ]] && echo $resp || (echo $resp && exit 1)

- name: Run tests
run: npm run test
run: ./gradlew test
env:
CI: true

- run: ./gradlew composeLogs
if: ${{ always() }}
Expand Down
20 changes: 17 additions & 3 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
import org.apache.tools.ant.taskdefs.condition.Os

plugins {
id("com.avast.gradle.docker-compose") version "0.16.8"
}

tasks {
register<Exec>("test") {
executable = getNpm()
args("run", "build-test")
}
register("cleanPackDir") {
file("pack/").mkdirs()
file("pack/").listFiles()?.forEach { it.delete() }
Expand All @@ -14,13 +20,13 @@ tasks {

register<Exec>("makeDist") {
dependsOn("cleanPackDir")
executable = "npm"
executable = getNpm()
args("run", "build")
}

register<Exec>("buildDist") {
dependsOn("makeDist")
executable = "npm"
executable = getNpm()
args("pack", "--pack-destination=./pack")
}

Expand All @@ -37,7 +43,15 @@ tasks {
}

dockerCompose {
dockerComposeWorkingDirectory.set(File("./e2e"))
removeVolumes.set(true)
waitForTcpPorts.set(false)
}

// Make npm work on Windows
fun getNpm(): String {
return if (Os.isFamily(Os.FAMILY_WINDOWS)) {
"npm.cmd"
} else {
"npm"
}
}
19 changes: 4 additions & 15 deletions e2e/docker-compose.yml → docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,16 @@
version: '3.3'
services:
e2e-test:
container_name: e2e-test
build:
context: .
depends_on:
- spp-platform
links:
- spp-platform
ports:
- "5000:5000"
spp-platform:
image: sourceplusplus/spp-platform:latest
container_name: spp-platform
hostname: spp-platform
ports:
- "11800:11800"
- "11801:11801" #todo: shouldn't be necessary
- "12800:12800"
- "5106:5106"
environment:
- SPP_LOGGING_LEVEL=trace
- JAVA_OPTS=-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5106
- SPP_LOGGING_LEVEL=debug
- SW_RECEIVER_GRPC_SSL_ENABLED=false #todo: fix this and config.secure = false
- SPP_HTTP_SSL_ENABLED=false #todo; Change back to ssl once the library works with self-signed certs
volumes:
- ./config/spp-platform.crt:/skywalking/config/spp-platform.crt
- ./config/spp-platform.key:/skywalking/config/spp-platform.key
- SPP_GRPC_SSL_ENABLED=false
16 changes: 0 additions & 16 deletions e2e/Dockerfile

This file was deleted.

22 changes: 0 additions & 22 deletions e2e/E2ETest.js

This file was deleted.

30 changes: 0 additions & 30 deletions e2e/config/spp-platform.crt

This file was deleted.

51 changes: 0 additions & 51 deletions e2e/config/spp-platform.key

This file was deleted.

41 changes: 0 additions & 41 deletions e2e/spp-probe.yml

This file was deleted.

10 changes: 1 addition & 9 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,12 +1,4 @@
kotlin.code.style=official

probeGroup=plus.sourceplus.probe

vertxVersion=4.3.0

jacksonVersion=2.13.1
gsonVersion = 2.8.6
jupiterVersion = 5.8.0
logbackVersion = 1.2.6

sppVersion=0.5.5-SNAPSHOT
projectVersion=0.6.3-SNAPSHOT
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"scripts": {
"build": "tsc",
"test": "mocha test/*.js",
"build-test": "npm run build && npm run test",
"prepublishOnly": "npm run build"
},
"peerDependencies": {
Expand Down
34 changes: 4 additions & 30 deletions spp-probe.yml
Original file line number Diff line number Diff line change
@@ -1,39 +1,13 @@
spp-probe:
host: "127.0.0.1"
grpc_port: 11801
grpc_port: 11800
rest_port: 12800
quiet_mode: false
verify_host: false
ssl_enabled: false
platform_certificate: |
MIIFLzCCAxegAwIBAgIGAYG9v8lfMA0GCSqGSIb3DQEB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AAOC
AgEAQyBpimXMYDuIEL8PXCab8EzoRfsu+Ot5ZdcwkAE/93H0YnTHr7+79WzTnIcj
VW/MQ4keDQSljjA6x9Te2+qH2eMFuPPa0X5iXkLQaJro3kaVzi/NWbHkJ2RSemsw
6lqx0G0f1ojoIXcgmurwlTRyoU/5wikX2WTS8VSA9Tylv5K6nYXaEU5eMCCdt9rI
5RQGMatQDNPmwJCgwkW2+zpDJTBSPl7i7qym5+ljCKD+Vuawq9SRTU1I3BZXB1bN
LdlZLrCbnM9nSW64oXG7X5h2t2N8PifCg/kwiE5UHO9snv1a6bjHyVyBXOhS4zJT
JhM8i8911uCaxc6e+fBknT4t2V7DET3MCxUQ2fvJ75JgBD3OPo6qcpdOwWwrQiyC
nITRe+LLhZQfyIsfbXoNE930uFNQvoYoHIovrOm6nUPCzBRx9YOZpdOkbYi3V6tA
ooUtSLrQVO++tk4pZsvLRwZ5Yku+/J/nzjYDk+dtCxd5bM3vHAfhEjzvijouVCA3
+7VjhiWpBSNeUt7ENX9s2GGs0OjUCAoOFoOENDcZdu7u9hrzUIhHsFGTyL0DQ1lT
Ip40RbmWHOunjHYEZRbJhB2Mo+hcIMGpARIq3WSYQFZnxBbchqnUnVvvo/bE5yB8
g6TYnkFuMFHg/LvA7RX1v2Xha5YSEHBBV7V2emBmZc1Tpkk=
authentication:
client_id: "test-id"
client_secret: "test-secret"
skywalking:
logging:
level: "INFO"
Expand Down
3 changes: 3 additions & 0 deletions src/ProbeMemory.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
let probeMemory = {};

export default probeMemory;
7 changes: 7 additions & 0 deletions src/SourcePlusPlus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ namespace SourcePlusPlus {

probeConfig.skywalking.collector.backend_service = getConfigValueString("SW_COLLECTOR_BACKEND_SERVICE",
probeConfig.skywalking.collector.backend_service, `${probeConfig.spp.host}:${probeConfig.spp.grpc_port}`);
probeConfig.skywalking.agent.authentication = probeConfig.spp.authentication.tenant_id ?
`${probeConfig.spp.authentication.client_id}:${probeConfig.spp.authentication.client_secret}:${probeConfig.spp.authentication.tenant_id}`
: `${probeConfig.spp.authentication.client_id}:${probeConfig.spp.authentication.client_secret}`;

// Copy given config
Object.assign(probeConfig, config);
Expand All @@ -81,6 +84,7 @@ namespace SourcePlusPlus {
async function attach(): Promise<void> {
config.collectorAddress = probeConfig.skywalking.collector.backend_service;
config.serviceName = probeConfig.skywalking.agent.service_name;
config.authorization = probeConfig.skywalking.agent.authentication;
// TODO: logReporterActive doesn't exist?
config.secure = false; //todo: fix this and SW_RECEIVER_GRPC_SSL_ENABLED=false

Expand All @@ -106,6 +110,9 @@ namespace SourcePlusPlus {
});
eventBus.enableReconnect(true);

// Add authentication headers
eventBus.defaultHeaders = probeConfig.spp.authentication;

return new Promise<void>((resolve, reject) => {
eventBus.onopen = () => {
debugLog("Connected to Source++ Platform");
Expand Down
Loading