-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #895 from kuisathaverat/feat/portable
feat: make demo more portable
- Loading branch information
Showing
13 changed files
with
192 additions
and
51 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
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,21 @@ | ||
NAME = 'import_dashboard' | ||
DSL = """pipeline { | ||
agent any | ||
stages { | ||
stage('Import Dashboard') { | ||
steps { | ||
sh(label: 'Download dashboard', script: 'curl -sSfL -o dashboard.ndjson https://raw.githubusercontent.com/jenkinsci/opentelemetry-plugin/main/src/main/kibana/jenkins-kibana-dashboards.ndjson') | ||
sh(label: 'Import Dashboard', script: 'curl -X POST -u "admin:changeme" http://kibana:5601/api/saved_objects/_import -H "kbn-xsrf: true" --form [email protected]') | ||
} | ||
} | ||
} | ||
} | ||
""" | ||
|
||
pipelineJob(NAME) { | ||
definition { | ||
cps { | ||
script(DSL.stripIndent()) | ||
} | ||
} | ||
} |
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
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
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
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,55 @@ | ||
NAME = 'pytest-otel' | ||
DSL = """pipeline { | ||
agent any | ||
stages { | ||
stage('checkout') { | ||
steps { | ||
git(url: 'https://github.com/kuisathaverat/pytest_otel.git', branch: 'main') | ||
} | ||
} | ||
stage('prepare-python') { | ||
steps { | ||
installHermit() | ||
} | ||
} | ||
stage('test') { | ||
steps { | ||
script { | ||
runWithHermit(){ | ||
sh(label: 'dependencies', script: 'pip install ".[test]"') | ||
sh(label: 'pytest', script: 'python -m pytest --capture=no docs/demos/test/test_demo.py') | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
def runWithHermit(Closure body){ | ||
hermitEnvVars = sh(returnStdout: true, script: './hermit/bin/hermit env --raw').trim() | ||
withEnv(hermitEnvVars.split('\\n').toList()) { | ||
body() | ||
} | ||
} | ||
|
||
def installHermit() { | ||
sh(label: 'installHermit', | ||
script: 'curl -fsSL https://github.com/cashapp/hermit/releases/download/stable/install.sh | /bin/bash') | ||
sh(label: 'install tools', | ||
script: ''' | ||
mkdir -p hermit | ||
cd hermit | ||
~/bin/hermit init | ||
eval \$(./bin/hermit env --raw) | ||
hermit install python3 | ||
''') | ||
} | ||
""" | ||
|
||
pipelineJob(NAME) { | ||
definition { | ||
cps { | ||
script(DSL.stripIndent()) | ||
} | ||
} | ||
} |
Oops, something went wrong.