Unterschiede
Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
| de:modul:ffit:3-jahr:cicd:learningunits:lu12:b [2026/05/14 20:36] – angelegt apeter | de:modul:ffit:3-jahr:cicd:learningunits:lu12:b [2026/05/17 08:35] (aktuell) – apeter | ||
|---|---|---|---|
| Zeile 1: | Zeile 1: | ||
| - | ====== LU12b - Github Secrets | + | ====== LU12b - Variablen im Jenkinsfile |
| + | |||
| + | Die Verwendung von Variablen in Jenkinsfile ist manchmal nicht intuitiv, weil zwei unterschiedliche Interpreter im Spiel sind | ||
| + | - **Groovy/ | ||
| + | - **Shell/ | ||
| + | |||
| + | Dabei spielen die gewählten Anführungszeichen eine entscheidende Rolle | ||
| + | * Variablen innerhalb von Double-Quotations werden durch Groovy interpretiert. | ||
| + | * Variablen innerhalb von Single-Quotations werden nicht durch Groovy interpretiert, | ||
| + | |||
| + | Grundsätzlich können überall Double-Quotations genutzt werden, sofern Shell-Variablen escaped werden. | ||
| + | |||
| + | Folgende Tabelle gibt eine Übersicht. | ||
| + | |||
| + | ^ Variablen-Art ^ Schreibweise ^ Kommentar ^ | ||
| + | | Jenkins/env var | < | ||
| + | <code bash>sh """ | ||
| + | PUBLIC_URL=/ | ||
| + | """</ | ||
| + | <code bash>sh """ | ||
| + | -e POSTGRES_USER=$DB_USER | ||
| + | """</ | ||
| + | </ | ||
| + | | Echte Groovy-Variable | < | ||
| + | <code bash>sh """ | ||
| + | ${scannerHome}/ | ||
| + | """</ | ||
| + | <code bash>sh """ | ||
| + | $scannerHome/ | ||
| + | """</ | ||
| + | </ | ||
| + | | Echte Shell-Variable | < | ||
| + | <code bash>sh """ | ||
| + | if [ " | ||
| + | """</ | ||
| + | <code bash>sh """ | ||
| + | if [ " | ||
| + | """</ | ||
| + | </ | ||
| + | | Jenkins/env var | < | ||
| + | <code bash>sh ''' | ||
| + | PUBLIC_URL=/ | ||
| + | '''</ | ||
| + | <code bash>sh ''' | ||
| + | -e POSTGRES_USER=$DB_USER | ||
| + | '''</ | ||
| + | </ | ||
| + | | Echte Groovy-Variable | < | ||
| + | <code bash>sh ''' | ||
| + | ${scannerHome}/ | ||
| + | '''</ | ||
| + | <code bash>sh ''' | ||
| + | $scannerHome/ | ||
| + | '''</ | ||
| + | </ | ||
| + | | Echte Shell-Variable | < | ||
| + | <code bash>sh ''' | ||
| + | if [ " | ||
| + | '''</ | ||
| + | <code bash>sh ''' | ||
| + | if [ " | ||
| + | '''</ | ||
| + | </ | ||
| - | * .env-Files | ||
| - | * Secrets in Github | ||
| - | * Secrets in Jenkins | ||
| - | * Sonar-Token | ||
| - | * Webhook? | ||
| - | '' | ||