File tree Expand file tree Collapse file tree 3 files changed +33
-5
lines changed Expand file tree Collapse file tree 3 files changed +33
-5
lines changed Original file line number Diff line number Diff line change @@ -13,11 +13,9 @@ source /usr/local/bin/.app-deploy-sources/__deploy_tags.sh
13
13
# Script used for creating the specific #
14
14
# tag used for triggering the CI deployment #
15
15
# #
16
- # End tag should look like this: #
17
- # internal-all/v1.0.0-1234 #
18
16
# #
19
17
# Prepared by Jasmin Abou Aldan #
20
- # Copyright (c) 2020 Infinum. All rights reserved. #
18
+ # Copyright (c) 2024 Infinum. All rights reserved. #
21
19
# ##############################################################
22
20
23
21
# Use global variables at your own risk as this can be overridden in the future.
@@ -45,7 +43,12 @@ function main {
45
43
46
44
deploy_options # Get from .deploy-options.sh, setup per project
47
45
__input_to_tags
48
- __create_app_version_and_build_number
46
+
47
+ if [ -z " $script_version " ] || [ " $script_version " == " v1" ]; then
48
+ __create_app_version_and_build_number
49
+ elif [ " $script_version " == " v2" ]; then
50
+ __create_trigger_ci_timestamp_tag
51
+ fi
49
52
50
53
# CREATE CHANGELOG
51
54
Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ function __input_to_tags {
20
20
}
21
21
22
22
# Generate app version and build number
23
+ # Used in v1 version of the script
23
24
function __create_app_version_and_build_number {
24
25
25
26
echo
@@ -68,6 +69,28 @@ function __create_app_version_and_build_number {
68
69
sleep 1
69
70
}
70
71
72
+ # Generate trigger tag with timestamp
73
+ # Used in v2 version of the script
74
+ function __create_trigger_ci_timestamp_tag {
75
+
76
+ # Create tag name ci/{environment}/{timestamp}}. E.g. ci/internal-staging/2024-12-05T17-16-28
77
+ tags_to_deploy=()
78
+
79
+ # Prefix ci
80
+ trigger_tag=" ci/"
81
+
82
+ # Environments
83
+ for target in " ${environments_to_build[@]} " ; do
84
+ trigger_tag+=" $target /"
85
+ done
86
+
87
+ # Sufix timestamp
88
+ trigger_tag+=" $( date +%Y-%m-%dT%H-%M-%S) "
89
+
90
+ # Assign to shared property
91
+ tags_to_deploy=(" $trigger_tag " )
92
+ }
93
+
71
94
# Changelog
72
95
function __generate_tag_and_changelog {
73
96
Original file line number Diff line number Diff line change @@ -18,7 +18,9 @@ function __push_tag_and_start_deploy {
18
18
echo " ---------------------------------------------------------------"
19
19
echo " ~ CONFIGURATION ~ "
20
20
echo
21
- echo " Version: ${bold} v$appversion -$tags_count ${normal} "
21
+ if [ -n " $appversion " ]; then
22
+ echo " Version: ${bold} v$appversion -$tags_count ${normal} "
23
+ fi
22
24
for tag in " ${tags_to_deploy[@]} " ; do
23
25
echo " Tag: ${bold} $tag ${normal} "
24
26
done
You can’t perform that action at this time.
0 commit comments