fix: rebuild image
This commit is contained in:
22
Jenkinsfile
vendored
22
Jenkinsfile
vendored
@@ -15,29 +15,20 @@ pipeline {
|
||||
branch 'develop'
|
||||
}
|
||||
steps {
|
||||
// 1. Uruchomienie Testów
|
||||
script {
|
||||
echo '--- [DEVELOP] 1. Uruchamianie testów E2E ---'
|
||||
sh 'docker compose -f docker-compose.test.yml down -v || true'
|
||||
sh 'docker compose -f docker-compose.test.yml up --build --abort-on-container-exit --exit-code-from cypress'
|
||||
}
|
||||
|
||||
// 2. Scalanie (Bez zmiany wersji!)
|
||||
sshagent(credentials: ['gitea-ssh-key']) {
|
||||
script {
|
||||
echo '--- [DEVELOP] 2. Testy OK. Scalanie do Main ---'
|
||||
|
||||
sh "git config user.name '${GIT_AUTHOR_NAME}'"
|
||||
sh "git config user.email '${GIT_AUTHOR_EMAIL}'"
|
||||
|
||||
// Pobieramy main, scalamy i wysyłamy
|
||||
sh 'git fetch origin main'
|
||||
sh 'git checkout main'
|
||||
sh 'git pull origin main'
|
||||
|
||||
sh 'git merge origin/develop --no-ff -m "Release: Merge develop to main"'
|
||||
|
||||
// To uruchomi pipeline na branchu MAIN
|
||||
sh 'GIT_SSH_COMMAND="ssh -o StrictHostKeyChecking=no" git push origin main'
|
||||
}
|
||||
}
|
||||
@@ -61,12 +52,13 @@ pipeline {
|
||||
withCredentials([string(credentialsId: 'npm-token', variable: 'NPM_TOKEN')]) {
|
||||
script {
|
||||
echo '--- [MAIN] Start procedury publikacji ---'
|
||||
|
||||
// 1. Pobierz wersję
|
||||
|
||||
def localVersion = sh(script: "grep '\"version\":' package.json | cut -d\\\" -f4", returnStdout: true).trim()
|
||||
echo "Lokalna wersja w package.json: ${localVersion}"
|
||||
|
||||
// 2. Sprawdź wersję (tu używamy -w, ale bez tokenu, bo view jest publiczne)
|
||||
|
||||
echo '--- Przebudowywanie obrazu z aktualnym kodem ---'
|
||||
sh 'docker compose -f docker-compose.test.yml build app'
|
||||
|
||||
def versionExists = false
|
||||
try {
|
||||
sh "docker compose -f docker-compose.test.yml run --rm -w /app/wc-timer app npm view wc-timer@${localVersion} version"
|
||||
@@ -81,10 +73,6 @@ pipeline {
|
||||
} else {
|
||||
echo "🚀 Wersja ${localVersion} jest nowa. Publikuję..."
|
||||
|
||||
// 3. PUBLIKACJA "INJECTION METHOD"
|
||||
// Nie montujemy pliku (-v).
|
||||
// Przekazujemy token przez zmienną (-e).
|
||||
// Tworzymy plik wewnątrz kontenera i publikujemy w jednej komendzie (sh -c).
|
||||
sh """
|
||||
docker compose -f docker-compose.test.yml run --rm \
|
||||
-w /app/wc-timer \
|
||||
|
||||
Reference in New Issue
Block a user