Skip to content

Commit 6660cc3

Browse files
authored
action: tav (#3127)
Migrate TAV to run as GitHub actions when - a merge commit in the `main` branch - manually triggered TAV matrix is declared in the GH workflow hence no more .tav files to be maintained. We agreed recently that It will not run on PRs for now, if needed we can add that feature in a follow up, maybe using the smarter jenkins implementation if it still works.
1 parent 5714e65 commit 6660cc3

File tree

5 files changed

+80
-142
lines changed

5 files changed

+80
-142
lines changed

.ci/.jenkins_tav.yml

-36
This file was deleted.

.ci/.jenkins_tav_nodejs.yml

-8
This file was deleted.

.ci/Jenkinsfile

+1-97
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ pipeline {
3434
parameters {
3535
booleanParam(name: 'Run_As_Main_Branch', defaultValue: false, description: 'Allow to run any steps on a PR, some steps normally only run on main branch.')
3636
booleanParam(name: 'bench_ci', defaultValue: true, description: 'Enable benchmarks.')
37-
booleanParam(name: 'tav_ci', defaultValue: true, description: 'Enable TAV tests.')
3837
booleanParam(name: 'tests_ci', defaultValue: true, description: 'Enable tests.')
3938
}
4039
stages {
@@ -51,11 +50,6 @@ pipeline {
5150
stash allowEmpty: true, name: 'source', useDefaultExcludes: false
5251
script {
5352
dir("${BASE_DIR}"){
54-
def regexps =[
55-
"^lib/instrumentation/modules/",
56-
"^test/instrumentation/modules/"
57-
]
58-
env.TAV_UPDATED = isGitRegionMatch(patterns: regexps)
5953

6054
// Skip all the stages except docs for PR's with asciidoc or md changes only
6155
env.ONLY_DOCS = isGitRegionMatch(patterns: [ '.*\\.(asciidoc|md)' ], shouldMatchAll: true)
@@ -94,47 +88,6 @@ pipeline {
9488
}
9589
}
9690
}
97-
/**
98-
Run TAV tests.
99-
*/
100-
stage('TAV Test') {
101-
options { skipDefaultCheckout() }
102-
environment {
103-
HOME = "${env.WORKSPACE}"
104-
}
105-
when {
106-
beforeAgent true
107-
allOf {
108-
not { tag pattern: 'v\\d+\\.\\d+\\.\\d+', comparator: 'REGEXP' }
109-
anyOf {
110-
expression { return params.Run_As_Main_Branch }
111-
triggeredBy 'TimerTrigger'
112-
changeRequest()
113-
expression { return env.TAV_UPDATED != "false" }
114-
}
115-
expression { return params.tav_ci }
116-
expression { return env.ONLY_DOCS == "false" }
117-
}
118-
}
119-
steps {
120-
deleteDir()
121-
unstash 'source'
122-
dir("${BASE_DIR}"){
123-
script {
124-
def tavContext = getSmartTAVContext()
125-
withGithubNotify(context: tavContext.ghContextName, description: tavContext.ghDescription, tab: 'tests') {
126-
def parallelTasks = [:]
127-
tavContext.node['NODEJS_VERSION'].each{ version ->
128-
tavContext.tav['TAV'].each{ tav_item ->
129-
parallelTasks["Node.js-${version}-${tav_item}"] = generateStep(version: version, tav: tav_item)
130-
}
131-
}
132-
parallel(parallelTasks)
133-
}
134-
}
135-
}
136-
}
137-
}
13891

13992
stage('Release') {
14093
options { skipDefaultCheckout() }
@@ -283,7 +236,6 @@ pipeline {
283236

284237
def generateStep(Map params = [:]){
285238
def version = params?.version
286-
def tav = params.containsKey('tav') ? params.tav : ''
287239
def buildType = params.containsKey('buildType') ? params.buildType : 'release'
288240
def contextManager = params.get('disableAsyncHooks', false) ? 'patch' : ''
289241
return {
@@ -296,7 +248,7 @@ def generateStep(Map params = [:]){
296248
dir("${BASE_DIR}"){
297249
try {
298250
retryWithSleep(retries: 2, seconds: 5, backoff: true) {
299-
sh(label: "Run Tests", script: """.ci/scripts/test.sh -b "${buildType}" -t "${tav}" "${version}" """)
251+
sh(label: "Run Tests", script: """.ci/scripts/test.sh -b "${buildType}" "${version}" """)
300252
}
301253
} finally {
302254
junit(testResults: "test_output/*.junit.xml", allowEmptyResults: true, keepLongStdio: true)
@@ -309,54 +261,6 @@ def generateStep(Map params = [:]){
309261
}
310262
}
311263

312-
/**
313-
* Gather the TAV context for the current execution. Then the TAV stage will execute
314-
* the TAV using a smarter approach.
315-
*/
316-
def getSmartTAVContext() {
317-
context = [:]
318-
context.ghContextName = 'TAV Test'
319-
context.ghDescription = context.ghContextName
320-
context.node = readYaml(file: '.ci/.jenkins_tav_nodejs.yml')
321-
322-
// Hard to debug what's going on as there are a few nested conditions. Let's then add more verbose output
323-
echo """\
324-
env.GITHUB_COMMENT=${env.GITHUB_COMMENT}
325-
params.Run_As_Main_Branch=${params.Run_As_Main_Branch}
326-
env.CHANGE_ID=${env.CHANGE_ID}
327-
env.TAV_UPDATED=${env.TAV_UPDATED}""".stripIndent()
328-
329-
if (env.GITHUB_COMMENT) {
330-
def modules = getModulesFromCommentTrigger(regex: 'run module tests for (.+)')
331-
if (modules.isEmpty()) {
332-
context.ghDescription = 'TAV Test disabled'
333-
context.tav = readYaml(text: 'TAV:')
334-
context.node = readYaml(text: 'NODEJS_VERSION:')
335-
} else {
336-
if (modules.find{ it == 'ALL' }) {
337-
context.tav = readYaml(file: '.ci/.jenkins_tav.yml')
338-
} else {
339-
context.ghContextName = 'TAV Test Subset'
340-
context.ghDescription = 'TAV Test comment-triggered'
341-
context.tav = readYaml(text: """TAV:${modules.collect{ it.replaceAll('"', '').replaceAll("'", '') }.collect{ "\n - '${it}'"}.join("") }""")
342-
}
343-
}
344-
} else if (params.Run_As_Main_Branch) {
345-
context.ghDescription = 'TAV Test param-triggered'
346-
context.tav = readYaml(file: '.ci/.jenkins_tav.yml')
347-
} else if (env.CHANGE_ID && env.TAV_UPDATED != "false") {
348-
context.ghContextName = 'TAV Test Subset'
349-
context.ghDescription = 'TAV Test changes-triggered'
350-
sh '.ci/scripts/get_tav.sh .ci/.jenkins_generated_tav.yml'
351-
context.tav = readYaml(file: '.ci/.jenkins_generated_tav.yml')
352-
} else {
353-
context.ghDescription = 'TAV Test disabled'
354-
context.tav = readYaml(text: 'TAV:')
355-
context.node = readYaml(text: 'NODEJS_VERSION:')
356-
}
357-
return context
358-
}
359-
360264
def generateStepForWindows(Map params = [:]){
361265
def version = params?.version
362266
def contextManager = params.get('disableAsyncHooks', false) ? 'patch' : ''

.github/workflows/opentelemetry.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: OpenTelemetry Export Trace
22

33
on:
44
workflow_run:
5-
workflows: [Edge, Test, Lint, Snapshoty, updatecli]
5+
workflows: [Edge, Test, Lint, Snapshoty, TAV, updatecli]
66
types: [completed]
77

88
jobs:

.github/workflows/tav.yml

+78
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
name: TAV
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches:
7+
- main
8+
paths-ignore:
9+
- '**/*.md'
10+
- '**/*.asciidoc'
11+
- 'docs/**'
12+
- 'examples/**'
13+
14+
concurrency:
15+
group: ${{ github.workflow }}-${{ github.ref }}
16+
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
17+
18+
# limit the access of the generated GITHUB_TOKEN
19+
permissions:
20+
contents: read
21+
22+
jobs:
23+
test-tav:
24+
runs-on: ubuntu-latest
25+
timeout-minutes: 40
26+
strategy:
27+
max-parallel: 30
28+
fail-fast: false
29+
matrix:
30+
node:
31+
- "19"
32+
- "18"
33+
- "16"
34+
- "14"
35+
- "12"
36+
- "10"
37+
- "8"
38+
module:
39+
- '@elastic/elasticsearch'
40+
- '@elastic/elasticsearch-canary'
41+
- '@hapi/hapi'
42+
- '@koa/router'
43+
- apollo-server-express
44+
- aws-sdk
45+
- bluebird
46+
- cassandra-driver
47+
- elasticsearch
48+
- express
49+
- express-graphql
50+
- express-queue
51+
- fastify
52+
- finalhandler
53+
- generic-pool
54+
- got
55+
- graphql
56+
- handlebars
57+
- ioredis
58+
- knex
59+
- koa-router
60+
- memcached
61+
- mimic-response
62+
- mongodb
63+
- mongodb-core
64+
- mysql
65+
- mysql2
66+
- next
67+
- pg
68+
- pug
69+
- redis
70+
- restify
71+
- tedious
72+
- undici
73+
- ws
74+
steps:
75+
- uses: actions/checkout@v3
76+
- run: .ci/scripts/test.sh -b "release" -t "${{ matrix.module }}" "${{ matrix.node }}"
77+
env:
78+
ELASTIC_APM_CONTEXT_MANAGER: ''

0 commit comments

Comments
 (0)