Skip to content
Snippets Groups Projects
Commit 8ec57ca1 authored by Denis Gremaud's avatar Denis Gremaud
Browse files

update pipline test

parent 09b97457
No related branches found
No related tags found
No related merge requests found
...@@ -41,12 +41,10 @@ unit_test2: ...@@ -41,12 +41,10 @@ unit_test2:
script: script:
- echo "This job shall test that the version string in '${APP_PAGE}' is only incremented" - echo "This job shall test that the version string in '${APP_PAGE}' is only incremented"
- git clone --depth=1 ${CLONE_URL_TOK}/${CI_PROJECT_PATH} - git clone --depth=1 ${CLONE_URL_TOK}/${CI_PROJECT_PATH}
- cd ${CI_PROJECT_NAME}
- | - |
# Navigate to the project directory # Find the commit hash before the current commit where ${APP_PAGE} was changed
cd ${CI_PROJECT_NAME} LAST_COMMIT_HASH=$(git rev-list HEAD -- ${APP_PAGE} | sed -n '2p')
# Find the second last commit hash where ${APP_PAGE} was changed
LAST_COMMIT_HASH=$(git log -3 --pretty=format:"%H" -- ${APP_PAGE} | tail -n 1)
# Extract the version string from that commit for ${APP_PAGE} # Extract the version string from that commit for ${APP_PAGE}
PREVIOUS_VERSION_STRING=$(git show ${LAST_COMMIT_HASH}:${APP_PAGE} | sed -nr "/^\s*Version:\s+([[:digit:]]\.){2}[[:digit:]]\s*\$/p" | cut -d" " -f2) PREVIOUS_VERSION_STRING=$(git show ${LAST_COMMIT_HASH}:${APP_PAGE} | sed -nr "/^\s*Version:\s+([[:digit:]]\.){2}[[:digit:]]\s*\$/p" | cut -d" " -f2)
...@@ -56,7 +54,6 @@ unit_test2: ...@@ -56,7 +54,6 @@ unit_test2:
CURRENT_VERSION_STRING=$(sed -nr "/^\s*Version:\s+([[:digit:]]\.){2}[[:digit:]]\s*\$/p" ${APP_PAGE} | cut -d" " -f2) CURRENT_VERSION_STRING=$(sed -nr "/^\s*Version:\s+([[:digit:]]\.){2}[[:digit:]]\s*\$/p" ${APP_PAGE} | cut -d" " -f2)
CURRENT_PATCH_NUMBER=$(echo $CURRENT_VERSION_STRING | cut -d"." -f3) CURRENT_PATCH_NUMBER=$(echo $CURRENT_VERSION_STRING | cut -d"." -f3)
echo "Version string in ${APP_PAGE}: ${VERSION_STRING}"
echo "Previous version string: ${PREVIOUS_VERSION_STRING}" echo "Previous version string: ${PREVIOUS_VERSION_STRING}"
echo "Current version string: ${CURRENT_VERSION_STRING}" echo "Current version string: ${CURRENT_VERSION_STRING}"
...@@ -66,8 +63,6 @@ unit_test2: ...@@ -66,8 +63,6 @@ unit_test2:
exit 1 exit 1
fi fi
deploy_prod: deploy_prod:
stage: deploy stage: deploy
environment: environment:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment