Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
Lab-GitLab-CI-CD
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Model registry
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
denis.gremaud
Lab-GitLab-CI-CD
Commits
c71016c9
Commit
c71016c9
authored
1 year ago
by
Denis Gremaud
Browse files
Options
Downloads
Patches
Plain Diff
update pipline test
parent
a37dc34b
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
.gitlab-ci.yml
+0
-27
0 additions, 27 deletions
.gitlab-ci.yml
with
0 additions
and
27 deletions
.gitlab-ci.yml
+
0
−
27
View file @
c71016c9
...
@@ -36,33 +36,6 @@ unit_test1:
...
@@ -36,33 +36,6 @@ unit_test1:
-
'
[[
$(sed
-nr
"/^\s*Version:\s+([[:digit:]]\.){2}[[:digit:]]\s*\$/p"
${CI_PROJECT_NAME}/${APP_PAGE}
|
wc
-l)
-eq
1
]]
-
'
[[
$(sed
-nr
"/^\s*Version:\s+([[:digit:]]\.){2}[[:digit:]]\s*\$/p"
${CI_PROJECT_NAME}/${APP_PAGE}
|
wc
-l)
-eq
1
]]
||
{
echo
"[error]
Version
string
badly
formatted
or
not
found";
exit
1;
}'
||
{
echo
"[error]
Version
string
badly
formatted
or
not
found";
exit
1;
}'
unit_test2
:
stage
:
test
script
:
-
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}
-
cd ${CI_PROJECT_NAME}
-
|
# Find the commit hash before the current commit where ${APP_PAGE} was changed
LAST_COMMIT_HASH=$(git rev-list HEAD -- ${APP_PAGE} | sed -n '2p')
# 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_PATCH_NUMBER=$(echo $PREVIOUS_VERSION_STRING | cut -d"." -f3)
# Extract the current version string from ${APP_PAGE}
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)
echo "Previous version string: ${PREVIOUS_VERSION_STRING}"
echo "Current version string: ${CURRENT_VERSION_STRING}"
# Check if the current patch number is one more than the previous patch number
if [[ $((CURRENT_PATCH_NUMBER)) -ne $((PREVIOUS_PATCH_NUMBER + 1)) ]]; then
echo "[error] Version string not incremented correctly"
exit 1
fi
deploy_prod
:
deploy_prod
:
stage
:
deploy
stage
:
deploy
environment
:
environment
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment