@colisweb/rescript-toolkit 5.49.3 → 5.49.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.secure_files/{ci-functions-v20.0.3 → ci-functions-v20.6.1-anchor-for_services} +294 -58
- package/.secure_files/{ci-functions-v20.0.0 → ci-functions-v20.6.1-anchor-for_services-beta} +440 -140
- package/.secure_files/{ci-functions-v20.0.1 → ci-functions-v20.7.0} +440 -140
- package/.secure_files/{ci-functions-v20.0.2 → ci-functions-v20.7.1} +443 -140
- package/package.json +1 -1
- package/src/ui/Toolkit__Ui_Timeline.res +1 -1
|
@@ -62,7 +62,7 @@ extract_arg() {
|
|
|
62
62
|
value=$3
|
|
63
63
|
if [ "--$name" != "$passed" ]; then
|
|
64
64
|
echo "missing argument $name"
|
|
65
|
-
|
|
65
|
+
return 1
|
|
66
66
|
fi
|
|
67
67
|
eval $name='$value'
|
|
68
68
|
}
|
|
@@ -452,12 +452,12 @@ configure_kubectl_for() {
|
|
|
452
452
|
database_k8s() {
|
|
453
453
|
MODE=$1
|
|
454
454
|
case $MODE in
|
|
455
|
-
"tests") SSH_LOCAL_PORT=2224;PG_LOCAL_PORT=24440;CA_LOCAL_PORT=25430;ENV="tests";;
|
|
456
|
-
"testing") SSH_LOCAL_PORT=2225;PG_LOCAL_PORT=24441;CA_LOCAL_PORT=25431;ENV="testing";;
|
|
457
|
-
"staging") SSH_LOCAL_PORT=2226;PG_LOCAL_PORT=24442;CA_LOCAL_PORT=25432;ENV="staging";;
|
|
458
|
-
"production") SSH_LOCAL_PORT=2227;PG_LOCAL_PORT=24443;CA_LOCAL_PORT=25433;ENV="production";;
|
|
459
|
-
"production_rw") SSH_LOCAL_PORT=2227;PG_LOCAL_PORT=24444;CA_LOCAL_PORT=25434;ENV="production";;
|
|
460
|
-
"recette") SSH_LOCAL_PORT=2228;PG_LOCAL_PORT=24446;CA_LOCAL_PORT=25436;ENV="recette";;
|
|
455
|
+
"tests") SSH_LOCAL_PORT=2224;COMP_LOCAL_PORT=25550;PG_LOCAL_PORT=24440;CA_LOCAL_PORT=25430;ENV="tests";;
|
|
456
|
+
"testing") SSH_LOCAL_PORT=2225;COMP_LOCAL_PORT=25551;PG_LOCAL_PORT=24441;CA_LOCAL_PORT=25431;ENV="testing";;
|
|
457
|
+
"staging") SSH_LOCAL_PORT=2226;COMP_LOCAL_PORT=25552;PG_LOCAL_PORT=24442;CA_LOCAL_PORT=25432;ENV="staging";;
|
|
458
|
+
"production") SSH_LOCAL_PORT=2227;COMP_LOCAL_PORT=25553;PG_LOCAL_PORT=24443;CA_LOCAL_PORT=25433;ENV="production";;
|
|
459
|
+
"production_rw") SSH_LOCAL_PORT=2227;COMP_LOCAL_PORT=25554;PG_LOCAL_PORT=24444;CA_LOCAL_PORT=25434;ENV="production";;
|
|
460
|
+
"recette") SSH_LOCAL_PORT=2228;COMP_LOCAL_PORT=25556; PG_LOCAL_PORT=24446;CA_LOCAL_PORT=25436;ENV="recette";;
|
|
461
461
|
*) echo "Unsupported ENV : $MODE"; return 1 ;;
|
|
462
462
|
esac
|
|
463
463
|
|
|
@@ -478,23 +478,28 @@ database_k8s() {
|
|
|
478
478
|
HostName 127.0.0.1
|
|
479
479
|
Port 2225
|
|
480
480
|
LocalForward 24441 toutatis-testing-db.ca0rjdmnxf1x.eu-west-1.rds.amazonaws.com:5432
|
|
481
|
+
LocalForward 25551 toutatis-testing-composite-db.ca0rjdmnxf1x.eu-west-1.rds.amazonaws.com:5432
|
|
481
482
|
LocalForward 25431 toutatis-testing-mysql-db.ca0rjdmnxf1x.eu-west-1.rds.amazonaws.com:3306
|
|
482
483
|
LocalForward 25531 testapirds.ca0rjdmnxf1x.eu-west-1.rds.amazonaws.com:3306
|
|
484
|
+
LocalForward 25561 toutatis-testing-oracle-db.ca0rjdmnxf1x.eu-west-1.rds.amazonaws.com:1521
|
|
483
485
|
Host bastion_staging
|
|
484
486
|
HostName 127.0.0.1
|
|
485
487
|
Port 2226
|
|
486
488
|
LocalForward 24442 toutatis-staging-db.ca0rjdmnxf1x.eu-west-1.rds.amazonaws.com:5432
|
|
489
|
+
LocalForward 25552 toutatis-staging-composite-db.ca0rjdmnxf1x.eu-west-1.rds.amazonaws.com:5432
|
|
487
490
|
LocalForward 25432 toutatis-staging-mysql-db.ca0rjdmnxf1x.eu-west-1.rds.amazonaws.com:3306
|
|
488
491
|
Host bastion_recette
|
|
489
492
|
HostName 127.0.0.1
|
|
490
493
|
Port 2228
|
|
491
494
|
LocalForward 24446 toutatis-recette-db.ca0rjdmnxf1x.eu-west-1.rds.amazonaws.com:5432
|
|
495
|
+
LocalForward 25556 toutatis-recette-composite-db.ca0rjdmnxf1x.eu-west-1.rds.amazonaws.com:5432
|
|
492
496
|
LocalForward 25436 toutatis-recette-mysql-db.ca0rjdmnxf1x.eu-west-1.rds.amazonaws.com:3306
|
|
493
497
|
LocalForward 25536 testapirds.ca0rjdmnxf1x.eu-west-1.rds.amazonaws.com:3306
|
|
494
498
|
Host bastion_production
|
|
495
499
|
HostName 127.0.0.1
|
|
496
500
|
Port 2227
|
|
497
501
|
LocalForward 24443 toutatis-production-db-replica.ca0rjdmnxf1x.eu-west-1.rds.amazonaws.com:5432
|
|
502
|
+
LocalForward 25553 toutatis-production-composite-db.ca0rjdmnxf1x.eu-west-1.rds.amazonaws.com:5432
|
|
498
503
|
LocalForward 25433 toutatis-production-mysql-db-replica.ca0rjdmnxf1x.eu-west-1.rds.amazonaws.com:3306
|
|
499
504
|
EOF
|
|
500
505
|
if [ "$MODE" = "production_rw" ] ; then
|
|
@@ -508,6 +513,7 @@ EOF
|
|
|
508
513
|
-F "$bastion_config" \
|
|
509
514
|
"bastion_$ENV"
|
|
510
515
|
|
|
516
|
+
echo "sample command (composite) : 'psql postgres://postgres@127.0.0.1:$COMP_LOCAL_PORT'"
|
|
511
517
|
echo "sample command : 'psql postgres://postgres@127.0.0.1:$PG_LOCAL_PORT'"
|
|
512
518
|
echo "sample command : 'mysql -u colisweb -h 127.0.0.1 -P $CA_LOCAL_PORT -p db_name'"
|
|
513
519
|
|
|
@@ -574,6 +580,9 @@ kube_init_database_once() {
|
|
|
574
580
|
|
|
575
581
|
psql_on_k8 $namespace once "$db_init_username:$db_init_password@$db_host:$db_port" -c 'GRANT ALL PRIVILEGES ON DATABASE '"$db_database"' TO '"$db_username"';'
|
|
576
582
|
echo "Granted all privileges for $db_username on $db_database"
|
|
583
|
+
|
|
584
|
+
psql_on_k8 $namespace once "$db_init_username:$db_init_password@$db_host:$db_port" -c 'GRANT ALL ON SCHEMA public TO '"$db_username"';'
|
|
585
|
+
echo "Granted all privileges for $db_username on schema public"
|
|
577
586
|
fi
|
|
578
587
|
|
|
579
588
|
echo "======================="
|
|
@@ -863,13 +872,17 @@ function kstatus() {
|
|
|
863
872
|
#!/usr/bin/env bash
|
|
864
873
|
|
|
865
874
|
k8_nodes_stats() {
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
875
|
+
ENV=${1:-testing}
|
|
876
|
+
|
|
877
|
+
configure_kubectl_for "${ENV}"
|
|
878
|
+
|
|
879
|
+
kubectl get nodes -o name |
|
|
880
|
+
xargs kubectl describe |
|
|
881
|
+
grep "^Name\|workType\|cpu \|memory " |
|
|
882
|
+
sed -r 's/[ :=]+/\t/g' |
|
|
883
|
+
sed 's/\tworkType\t//g' |
|
|
884
|
+
sed -r 's/^Name/---\nName/g' |
|
|
885
|
+
grep --color "Name\|web\|workers\|cpu\|memory\|---"
|
|
873
886
|
}
|
|
874
887
|
|
|
875
888
|
#!/usr/bin/env bash
|
|
@@ -935,14 +948,14 @@ pod_copy_to() {
|
|
|
935
948
|
|
|
936
949
|
pick_pod() {
|
|
937
950
|
ENV=$1
|
|
938
|
-
POD_FILTER
|
|
951
|
+
POD_FILTER=$2
|
|
939
952
|
configure_kubectl_for $ENV
|
|
940
953
|
|
|
941
954
|
if [ -z "$2" ] ; then
|
|
942
955
|
kubectl -n $ENV get pods | gum filter | cut -f1 -d" "
|
|
943
956
|
else
|
|
944
|
-
if PODS=$(kubectl -n $ENV get pods
|
|
945
|
-
echo $PODS
|
|
957
|
+
if PODS=$(kubectl -n $ENV get pods | grep -m1 "$POD_FILTER" | cut -f1 -d" "); then
|
|
958
|
+
echo $PODS
|
|
946
959
|
else
|
|
947
960
|
echo "no pods found on $ENV matching $POD_FILTER" >&2
|
|
948
961
|
fi
|
|
@@ -1422,6 +1435,182 @@ spec:
|
|
|
1422
1435
|
}
|
|
1423
1436
|
|
|
1424
1437
|
|
|
1438
|
+
#!/usr/bin/env bash
|
|
1439
|
+
|
|
1440
|
+
# Usage info
|
|
1441
|
+
show_help_shell() {
|
|
1442
|
+
local help="""Usage: run_job_k8s -s SCRIPT [-e ENV] [-c CONFIG] [-p POD] [-f FOLDER] [ARGS]
|
|
1443
|
+
Create a k8s job executing a script
|
|
1444
|
+
|
|
1445
|
+
-h display this help and exit
|
|
1446
|
+
-s SCRIPT run script SCRIPT on a pod (SCRIPT must be a .sc file)
|
|
1447
|
+
-e ENV opt. set execution environment (default to testing)
|
|
1448
|
+
-c CONFIG opt. secret file needed for the script (must be a .sc file, not a .secret file)
|
|
1449
|
+
-p POD opt. name of the pod to create (default to $USERNAME)
|
|
1450
|
+
-f FOLDER opt. name of the folder containing the scripts to execute (if SCRIPT needs other files)
|
|
1451
|
+
ARGS opt. additional arguments for SCRIPT
|
|
1452
|
+
|
|
1453
|
+
The organisation of the files must be the same locally as on the pod :
|
|
1454
|
+
- /code containing the script to execute (arg -s) and the other needed files (if the arg -f is used, it must reference this directory)
|
|
1455
|
+
- /conf containing the secret file (arg -c if used)
|
|
1456
|
+
E.g. in the script \"/code/script.sc\", to use a secret file \"/conf/secret.sc\", the import should look like \"import \$file.^.conf.secret.sc\"
|
|
1457
|
+
"""
|
|
1458
|
+
echo "$help"
|
|
1459
|
+
}
|
|
1460
|
+
|
|
1461
|
+
run_shell_k8s() {
|
|
1462
|
+
|
|
1463
|
+
#default values
|
|
1464
|
+
local namespace="testing"
|
|
1465
|
+
local name="$USERNAME"
|
|
1466
|
+
local secret=""
|
|
1467
|
+
local shell_folder=""
|
|
1468
|
+
local script_script=""
|
|
1469
|
+
|
|
1470
|
+
while getopts ":e:c:p:f:s:h" opt; do
|
|
1471
|
+
case $opt in
|
|
1472
|
+
e)
|
|
1473
|
+
namespace="$OPTARG" >&2
|
|
1474
|
+
;;
|
|
1475
|
+
p)
|
|
1476
|
+
name="$OPTARG" >&2
|
|
1477
|
+
;;
|
|
1478
|
+
c)
|
|
1479
|
+
secret="$OPTARG" >&2
|
|
1480
|
+
;;
|
|
1481
|
+
f)
|
|
1482
|
+
shell_folder="$OPTARG" >&2
|
|
1483
|
+
;;
|
|
1484
|
+
s)
|
|
1485
|
+
shell_script="$OPTARG" >&2
|
|
1486
|
+
;;
|
|
1487
|
+
h)
|
|
1488
|
+
show_help_job
|
|
1489
|
+
return 0
|
|
1490
|
+
;;
|
|
1491
|
+
:)
|
|
1492
|
+
echo "Option -$OPTARG requires an argument. Run run_cron_job_k8s -h for help" >&2
|
|
1493
|
+
return 0
|
|
1494
|
+
;;
|
|
1495
|
+
\?)
|
|
1496
|
+
echo "Invalid option: -$OPTARG. Run run_cron_job_k8s -h for help" >&2
|
|
1497
|
+
return 0
|
|
1498
|
+
;;
|
|
1499
|
+
esac
|
|
1500
|
+
done
|
|
1501
|
+
|
|
1502
|
+
if [ -z "$shell_script" ]; then
|
|
1503
|
+
echo 'Missing -s. Run run_job_k8s -h for help' >&2
|
|
1504
|
+
return 0
|
|
1505
|
+
fi
|
|
1506
|
+
|
|
1507
|
+
shift "$((OPTIND-1))"
|
|
1508
|
+
|
|
1509
|
+
local script_args=$(
|
|
1510
|
+
if [ "$#" -gt 0 ] ; then
|
|
1511
|
+
printf '"'
|
|
1512
|
+
join_by '", "' $*
|
|
1513
|
+
printf '"'
|
|
1514
|
+
fi
|
|
1515
|
+
)
|
|
1516
|
+
|
|
1517
|
+
|
|
1518
|
+
|
|
1519
|
+
|
|
1520
|
+
local IMAGE="949316342391.dkr.ecr.eu-west-1.amazonaws.com/docker-infra-builder:v3.1.0"
|
|
1521
|
+
local JOB_NAME="job-shell-$name"
|
|
1522
|
+
|
|
1523
|
+
if [[ ! -r "$shell_script" ]]; then
|
|
1524
|
+
echo "shell script not found $shell_script"
|
|
1525
|
+
return 2
|
|
1526
|
+
else
|
|
1527
|
+
local CONFIG_MAP="config-$JOB_NAME"
|
|
1528
|
+
local CONFIG_MAP_DIR="$(mktemp -d)"
|
|
1529
|
+
local SECRET_MAP="secret-$JOB_NAME"
|
|
1530
|
+
|
|
1531
|
+
configure_kubectl_for $namespace
|
|
1532
|
+
|
|
1533
|
+
if [[ ! -z $shell_folder && -d $shell_folder ]] ; then
|
|
1534
|
+
cp -r "$shell_folder/" "$CONFIG_MAP_DIR"
|
|
1535
|
+
fi
|
|
1536
|
+
cp "$shell_script" "$CONFIG_MAP_DIR/script.sh"
|
|
1537
|
+
|
|
1538
|
+
kubectl -n $namespace get configmap $CONFIG_MAP && kubectl -n $namespace delete configmap $CONFIG_MAP
|
|
1539
|
+
kubectl -n $namespace create configmap $CONFIG_MAP --from-file="$CONFIG_MAP_DIR"
|
|
1540
|
+
|
|
1541
|
+
kubectl -n $namespace get secret $SECRET_MAP && kubectl -n $namespace delete secret $SECRET_MAP
|
|
1542
|
+
kubectl -n $namespace create secret generic $SECRET_MAP --from-file="$secret"
|
|
1543
|
+
|
|
1544
|
+
kubectl -n $namespace get job $JOB_NAME && kubectl -n $namespace delete job $JOB_NAME
|
|
1545
|
+
|
|
1546
|
+
echo "starting $JOB_NAME with $IMAGE"
|
|
1547
|
+
fi
|
|
1548
|
+
|
|
1549
|
+
JOB_DEFINITION='
|
|
1550
|
+
apiVersion: batch/v1
|
|
1551
|
+
kind: Job
|
|
1552
|
+
metadata:
|
|
1553
|
+
name: '$JOB_NAME'
|
|
1554
|
+
namespace: '$namespace'
|
|
1555
|
+
spec:
|
|
1556
|
+
template:
|
|
1557
|
+
spec:
|
|
1558
|
+
containers:
|
|
1559
|
+
- name: '$JOB_NAME'
|
|
1560
|
+
command: ["bash", "/code/script.sh"]
|
|
1561
|
+
image: '$IMAGE'
|
|
1562
|
+
args: ['$script_args']
|
|
1563
|
+
env:
|
|
1564
|
+
- name: POD_NAME
|
|
1565
|
+
valueFrom:
|
|
1566
|
+
fieldRef:
|
|
1567
|
+
apiVersion: v1
|
|
1568
|
+
fieldPath: metadata.name
|
|
1569
|
+
- name: POD_NAMESPACE
|
|
1570
|
+
valueFrom:
|
|
1571
|
+
fieldRef:
|
|
1572
|
+
apiVersion: v1
|
|
1573
|
+
fieldPath: metadata.namespace
|
|
1574
|
+
- name: HOST_IP
|
|
1575
|
+
valueFrom:
|
|
1576
|
+
fieldRef:
|
|
1577
|
+
apiVersion: v1
|
|
1578
|
+
fieldPath: status.hostIP
|
|
1579
|
+
volumeMounts:
|
|
1580
|
+
- name: config
|
|
1581
|
+
mountPath: /code
|
|
1582
|
+
- name: secret
|
|
1583
|
+
mountPath: /conf
|
|
1584
|
+
readOnly: true
|
|
1585
|
+
resources:
|
|
1586
|
+
requests:
|
|
1587
|
+
cpu: 500m
|
|
1588
|
+
memory: 256Mi
|
|
1589
|
+
limits:
|
|
1590
|
+
cpu: 4000m
|
|
1591
|
+
memory: 1Gi
|
|
1592
|
+
nodeSelector:
|
|
1593
|
+
workType: workers
|
|
1594
|
+
restartPolicy: Never
|
|
1595
|
+
volumes:
|
|
1596
|
+
- name: config
|
|
1597
|
+
configMap:
|
|
1598
|
+
name: '$CONFIG_MAP'
|
|
1599
|
+
- name: secret
|
|
1600
|
+
secret:
|
|
1601
|
+
secretName: '$SECRET_MAP'
|
|
1602
|
+
- name: stockage
|
|
1603
|
+
|
|
1604
|
+
'
|
|
1605
|
+
|
|
1606
|
+
|
|
1607
|
+
echo $JOB_DEFINITION > /tmp/job.yaml
|
|
1608
|
+
|
|
1609
|
+
kubectl -n $namespace apply -f /tmp/job.yaml
|
|
1610
|
+
|
|
1611
|
+
}
|
|
1612
|
+
|
|
1613
|
+
|
|
1425
1614
|
#!/usr/bin/env bash
|
|
1426
1615
|
|
|
1427
1616
|
run_task() {
|
|
@@ -1538,51 +1727,53 @@ jwt_token() {
|
|
|
1538
1727
|
fi
|
|
1539
1728
|
}
|
|
1540
1729
|
|
|
1541
|
-
#!/bin/bash
|
|
1730
|
+
#!/usr/bin/env bash
|
|
1731
|
+
|
|
1732
|
+
alias update_devtool="git -C ~/.oh-my-zsh/custom/dev-tools/ pull"
|
|
1542
1733
|
|
|
1543
|
-
SCRIPT_PATH=$
|
|
1734
|
+
SCRIPT_PATH=$SCRIPT_FULL_PATH/shell/run
|
|
1544
1735
|
PATH="$PATH:$SCRIPT_PATH/script"
|
|
1545
1736
|
|
|
1546
1737
|
function get_token {
|
|
1547
1738
|
local ENV=$1
|
|
1548
|
-
local
|
|
1739
|
+
local LOGIN_FILE="$HOME/scriptlogin"
|
|
1549
1740
|
|
|
1550
|
-
if [ ! -f "$
|
|
1551
|
-
cat > "$
|
|
1741
|
+
if [ ! -f "$LOGIN_FILE" ]; then
|
|
1742
|
+
cat > "$LOGIN_FILE" <<-'EOF'
|
|
1552
1743
|
#!/bin/bash
|
|
1553
1744
|
case $ENV in
|
|
1554
1745
|
"testing")
|
|
1555
|
-
local
|
|
1556
|
-
local
|
|
1746
|
+
local BO_USERNAME=""
|
|
1747
|
+
local BO_PASSWORD=""
|
|
1557
1748
|
;;
|
|
1558
1749
|
"recette")
|
|
1559
|
-
local
|
|
1560
|
-
local
|
|
1750
|
+
local BO_USERNAME=""
|
|
1751
|
+
local BO_PASSWORD=""
|
|
1561
1752
|
;;
|
|
1562
1753
|
"staging")
|
|
1563
|
-
local
|
|
1564
|
-
local
|
|
1754
|
+
local BO_USERNAME=""
|
|
1755
|
+
local BO_PASSWORD=""
|
|
1565
1756
|
;;
|
|
1566
1757
|
*)
|
|
1567
|
-
local
|
|
1568
|
-
local
|
|
1569
|
-
echo "ENV ${ENV}
|
|
1758
|
+
local BO_USERNAME=""
|
|
1759
|
+
local BO_PASSWORD=""
|
|
1760
|
+
echo "ENV ${ENV} inconu"
|
|
1570
1761
|
return
|
|
1571
1762
|
;;
|
|
1572
1763
|
esac
|
|
1573
1764
|
EOF
|
|
1574
1765
|
fi
|
|
1575
1766
|
|
|
1576
|
-
source "${
|
|
1767
|
+
source "${LOGIN_FILE}"
|
|
1577
1768
|
|
|
1578
|
-
if [ -z "$
|
|
1769
|
+
if [ -z "$BO_PASSWORD" ] || [ -z "$BO_USERNAME" ]
|
|
1579
1770
|
then
|
|
1580
|
-
echo éditer le ficher "$
|
|
1771
|
+
echo éditer le ficher "$LOGIN_FILE"
|
|
1581
1772
|
return 1
|
|
1582
1773
|
fi
|
|
1583
1774
|
|
|
1584
1775
|
curl -o /dev/null -D - "https://api.$ENV.colisweb.com/api/v6/authent/external/session" \
|
|
1585
|
-
--data-raw '{"username":"'"${
|
|
1776
|
+
--data-raw '{"username":"'"${BO_USERNAME}"'","password":"'"${BO_PASSWORD/\"/\\\"}"'"}' \
|
|
1586
1777
|
--compressed 2> /dev/null | grep set-cook | sed -e 's/.*session=//g;s/;.*//g'
|
|
1587
1778
|
}
|
|
1588
1779
|
|
|
@@ -1597,29 +1788,53 @@ function bash_array_to_json {
|
|
|
1597
1788
|
}
|
|
1598
1789
|
|
|
1599
1790
|
function get_random_street {
|
|
1600
|
-
|
|
1601
|
-
|
|
1791
|
+
local CODE_POSTAUX_ARG=${1:-59000}
|
|
1792
|
+
IFS=',' read -r -a CODE_POSTAUX <<< "$CODE_POSTAUX_ARG"
|
|
1793
|
+
for CODE_POSTAL in "${CODE_POSTAUX[@]}"; do
|
|
1794
|
+
if [[ ! "$CODE_POSTAL" =~ ^[0-9]{5}$ ]]; then
|
|
1795
|
+
echo "Chaque CODE_POSTAL doit avoir une taille de 5 chiffre : $CODE_POSTAL"
|
|
1796
|
+
exit 1
|
|
1797
|
+
fi
|
|
1798
|
+
done
|
|
1799
|
+
local CODE_POSTAL=$(echo "${CODE_POSTAUX[@]}" | tr " " "\n" | sort -u -R | head -n 1)
|
|
1800
|
+
|
|
1801
|
+
get_random_street_in_cp $CODE_POSTAL
|
|
1802
|
+
}
|
|
1803
|
+
|
|
1804
|
+
function get_random_street_in_cp {
|
|
1805
|
+
local CODE_POSTAL=$1
|
|
1806
|
+
|
|
1807
|
+
FILENAME="rue-$CODE_POSTAL.lst"
|
|
1808
|
+
if [ ! -f "$FILENAME" ]; then
|
|
1809
|
+
curl --output tmp1.gz https://adresse.data.gouv.fr/data/ban/adresses/latest/csv/adresses-"${CODE_POSTAL:0:2}".csv.gz
|
|
1602
1810
|
gzip -d tmp1.gz
|
|
1603
|
-
cut -d\; -f3,5,6,8 tmp1 | sed
|
|
1604
|
-
rm
|
|
1811
|
+
cut -d\; -f3,5,6,8 tmp1 | sed "/;$CODE_POSTAL;/!d" > "$FILENAME"
|
|
1812
|
+
rm tmp1
|
|
1605
1813
|
fi
|
|
1606
1814
|
|
|
1607
|
-
sort -R
|
|
1815
|
+
sort -R "$FILENAME" | head -n 1
|
|
1608
1816
|
}
|
|
1609
1817
|
|
|
1610
1818
|
function rand_slot {
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1819
|
+
|
|
1820
|
+
local SCENARIO=$2
|
|
1821
|
+
if [ -f "$SCENARIO" ]; then
|
|
1822
|
+
source "$SCENARIO"
|
|
1823
|
+
fi
|
|
1824
|
+
local ORDER_DATE="$1"
|
|
1825
|
+
|
|
1826
|
+
DEFAULT=(
|
|
1827
|
+
"06:00+01:00[Europe/Paris]-08:00+01:00[Europe/Paris]"
|
|
1828
|
+
"08:00+01:00[Europe/Paris]-10:00+01:00[Europe/Paris]"
|
|
1829
|
+
"10:00+01:00[Europe/Paris]-12:00+01:00[Europe/Paris]"
|
|
1830
|
+
"16:00+01:00[Europe/Paris]-18:00+01:00[Europe/Paris]"
|
|
1831
|
+
"18:00+01:00[Europe/Paris]-20:00+01:00[Europe/Paris]"
|
|
1832
|
+
)
|
|
1833
|
+
USAGE=${DELIVERY_SLOTS:-${DEFAULT[@]}}
|
|
1834
|
+
|
|
1835
|
+
IFS="-" read -r start_time end_time < <(echo "${USAGE[@]}" | tr " " "\n" | sort -u -R | head -n 1 )
|
|
1836
|
+
|
|
1837
|
+
echo '{"start":"'"${ORDER_DATE}T${start_time}"'", "end":"'"${ORDER_DATE}T${end_time}"'" }'
|
|
1623
1838
|
}
|
|
1624
1839
|
|
|
1625
1840
|
function call_create_sfh_order {
|
|
@@ -1627,36 +1842,58 @@ function call_create_sfh_order {
|
|
|
1627
1842
|
local TOKEN=$2
|
|
1628
1843
|
source "$3"
|
|
1629
1844
|
local POS=$4
|
|
1630
|
-
local
|
|
1631
|
-
local
|
|
1845
|
+
local BARCODES="$5"
|
|
1846
|
+
local CODE_POSTAUX="$6"
|
|
1847
|
+
local PACKAGES=$(echo "$BARCODES" | jq '[{
|
|
1632
1848
|
"barcode": .[],
|
|
1633
|
-
"length":
|
|
1634
|
-
"height":
|
|
1635
|
-
"width":
|
|
1636
|
-
"weight":
|
|
1637
|
-
"description": "test
|
|
1849
|
+
"length": 20.0,
|
|
1850
|
+
"height": 15.0,
|
|
1851
|
+
"width": 4.0,
|
|
1852
|
+
"weight": 1.5,
|
|
1853
|
+
"description": "test parcel",
|
|
1638
1854
|
"options": [],
|
|
1639
1855
|
"productTypology": "Classical",
|
|
1640
1856
|
"packageType": "Parcel"
|
|
1641
1857
|
}
|
|
1642
1858
|
]')
|
|
1643
1859
|
|
|
1644
|
-
|
|
1860
|
+
DELIVERY_OPTIONS_P='['
|
|
1861
|
+
for option in "${DELIVERY_OPTIONS[@]}"; do
|
|
1862
|
+
if [ "$DELIVERY_OPTIONS_P" != '[' ]; then
|
|
1863
|
+
DELIVERY_OPTIONS_P+=", "
|
|
1864
|
+
fi
|
|
1865
|
+
DELIVERY_OPTIONS_P+="\"$option\""
|
|
1866
|
+
done
|
|
1867
|
+
DELIVERY_OPTIONS_P+=']'
|
|
1868
|
+
|
|
1869
|
+
IFS=";" read -r nu rue code_postal ville < <(get_random_street "$CODE_POSTAUX")
|
|
1870
|
+
|
|
1871
|
+
if [ -n "$PICKUP_STORE_CODE" ]; then
|
|
1872
|
+
PICKUP_LOCATION='{
|
|
1873
|
+
"type": "store",
|
|
1874
|
+
"storeCode": "'"$PICKUP_STORE_CODE"'"
|
|
1875
|
+
}'
|
|
1876
|
+
elif [ -n "$PICKUP_WAREHOUSE_CODE" ]; then
|
|
1877
|
+
PICKUP_LOCATION='{
|
|
1878
|
+
"type": "Warehouse",
|
|
1879
|
+
"warehouseCode": "'"$PICKUP_WAREHOUSE_CODE"'"
|
|
1880
|
+
}'
|
|
1881
|
+
else
|
|
1882
|
+
echo PICKUP_WAREHOUSE_CODE ou PICKUP_STORE_CODE doit être définie dans la "$3"
|
|
1883
|
+
exit 1
|
|
1884
|
+
fi
|
|
1645
1885
|
JSON='{
|
|
1646
1886
|
"primaryOrderReference": "'"${PRIMARY_REF}${POS}"'",
|
|
1647
1887
|
"secondaryOrderReference": null,
|
|
1648
1888
|
"stages": [
|
|
1649
1889
|
{
|
|
1650
1890
|
"type": "Pickup",
|
|
1651
|
-
"packageBarcodes": '"$
|
|
1652
|
-
"location":
|
|
1653
|
-
"type": "Warehouse",
|
|
1654
|
-
"warehouseCode": "'"$PICKUP_WAREHOUSE_CODE"'"
|
|
1655
|
-
}
|
|
1891
|
+
"packageBarcodes": '"$BARCODES"',
|
|
1892
|
+
"location": '"$PICKUP_LOCATION"'
|
|
1656
1893
|
},
|
|
1657
1894
|
{
|
|
1658
1895
|
"type": "Dropoff",
|
|
1659
|
-
"packageBarcodes": '"$
|
|
1896
|
+
"packageBarcodes": '"$BARCODES"',
|
|
1660
1897
|
"location": {
|
|
1661
1898
|
"type": "Address",
|
|
1662
1899
|
"address": {
|
|
@@ -1676,13 +1913,18 @@ function call_create_sfh_order {
|
|
|
1676
1913
|
],
|
|
1677
1914
|
"packages": '"$PACKAGES"',
|
|
1678
1915
|
"owner": {
|
|
1679
|
-
"accountIdentifier": "'$
|
|
1916
|
+
"accountIdentifier": "'$ACCOUNT_IDENTIFIER'"
|
|
1680
1917
|
},
|
|
1681
|
-
"deliveryOptions":
|
|
1682
|
-
"ecommerceValidationDate": "'"${
|
|
1918
|
+
"deliveryOptions": '"$DELIVERY_OPTIONS_P"',
|
|
1919
|
+
"ecommerceValidationDate": "'"${ORDER_DATE}"'"
|
|
1683
1920
|
}'
|
|
1684
1921
|
|
|
1685
|
-
curl -X POST https://api.$ENV.colisweb.com/api/v6/order/external/warehouse/orders -H 'content-type: application/json' --cookie session="$TOKEN" --data-raw "$JSON"
|
|
1922
|
+
RESULT=$(curl -s -X POST https://api.$ENV.colisweb.com/api/v6/order/external/warehouse/orders -H 'content-type: application/json' --cookie session="$TOKEN" --data-raw "$JSON")
|
|
1923
|
+
ORDER_ID=$(jq ".orderId" -r <<< "$RESULT")
|
|
1924
|
+
|
|
1925
|
+
echo "nouvelle commande : https://bo.$ENV.colisweb.com/admin/orders/$ORDER_ID" >&2
|
|
1926
|
+
|
|
1927
|
+
echo "$RESULT"
|
|
1686
1928
|
}
|
|
1687
1929
|
|
|
1688
1930
|
|
|
@@ -1690,10 +1932,9 @@ function call_scan {
|
|
|
1690
1932
|
local ENV=$1
|
|
1691
1933
|
local TOKEN=$2
|
|
1692
1934
|
source "$3"
|
|
1693
|
-
local
|
|
1694
|
-
local SCAN=$(echo "$
|
|
1935
|
+
local BARCODES="$4"
|
|
1936
|
+
local SCAN=$(echo "$BARCODES" | jq '[{"barcode" :.[], "context": "shuttle"}]')
|
|
1695
1937
|
|
|
1696
|
-
IFS=";" read -r nu rue code_postal ville < <(get_random_street)
|
|
1697
1938
|
JSON='{"scans":'$SCAN'}'
|
|
1698
1939
|
|
|
1699
1940
|
curl -X POST https://api.$ENV.colisweb.com/api/v6/parcel/external/units/scans/bulk -H 'content-type: application/json' --cookie session="$TOKEN" --data-raw "$JSON"
|
|
@@ -1707,18 +1948,21 @@ function call_register_delivery {
|
|
|
1707
1948
|
SCENARIO=$3
|
|
1708
1949
|
source "$SCENARIO"
|
|
1709
1950
|
|
|
1710
|
-
local
|
|
1711
|
-
local
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
"
|
|
1716
|
-
"storeIdOwner":"'"$STOREIDOWNER"'",
|
|
1951
|
+
local ORDER_ID=$4
|
|
1952
|
+
local BARCODES="$5"
|
|
1953
|
+
|
|
1954
|
+
DATA='{
|
|
1955
|
+
"slot": '"$(rand_slot "${DELIVERY_DATE}" "$SCENARIO")"',
|
|
1956
|
+
"storeIdOwner":"'"$STORE_ID_OWNER"'",
|
|
1717
1957
|
"pickup":{"type":"hub","code":"'"$HUB"'"},
|
|
1718
|
-
"barcodes":'"$
|
|
1958
|
+
"barcodes":'"$BARCODES"',
|
|
1719
1959
|
"price":{"origin":"auto","amount":25.9},
|
|
1720
|
-
"allowCustomerSlotUpdate":false
|
|
1960
|
+
"allowCustomerSlotUpdate":false,
|
|
1961
|
+
"withForcedSlot": false
|
|
1721
1962
|
}'
|
|
1963
|
+
|
|
1964
|
+
curl -X POST https://api.$ENV.colisweb.com/api/v6/order/external/warehouse/orders/"$ORDER_ID"/deliveries \
|
|
1965
|
+
--cookie session="$TOKEN" --data-raw "$DATA"
|
|
1722
1966
|
}
|
|
1723
1967
|
|
|
1724
1968
|
|
|
@@ -1727,25 +1971,45 @@ function _create_scenario_file_if_not_exist () {
|
|
|
1727
1971
|
if [ ! -f "$SCENARIO" ]
|
|
1728
1972
|
then
|
|
1729
1973
|
cat > "$SCENARIO" <<-'EOF'
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1974
|
+
DELIVERY_DATE=$(date -v+7d '+%Y-%m-%d') # ici on demande de crée a date d'aujourd'hui + 7 jours
|
|
1975
|
+
# peu remplacer -v+7d par -v+1d pour une livrasion programmer demain
|
|
1976
|
+
# utiliser que par create_many_sfh_order_and_delivery
|
|
1977
|
+
ENV="testing" # sur quelle enviromement lancer le scripts
|
|
1978
|
+
# ENV="staging"
|
|
1979
|
+
# ENV="recette"
|
|
1980
|
+
|
|
1981
|
+
ACCOUNT_IDENTIFIER="102" # pour la creation de order force utilies owner.accountIdentifier
|
|
1982
|
+
# sur l'appel api/v6/order/external/warehouse/orders
|
|
1983
|
+
# (creation de la commade)
|
|
1984
|
+
HUB="duck" # pour sur l'appel api/v6/order/external/warehouse/orders
|
|
1985
|
+
# parametre pickup.code (type est a "hub")
|
|
1986
|
+
STORE_ID_OWNER="184" # parametre pickup.storeIdOwner
|
|
1987
|
+
# sur l'appel api/v6/order/external/warehouse/orders
|
|
1988
|
+
# PICKUP_STORE_CODE="2" # si non commenté alors départ du magasin
|
|
1989
|
+
PICKUP_WAREHOUSE_CODE="422" # pour un départ d'entrepôt
|
|
1990
|
+
|
|
1991
|
+
BARCODES_COUNT=5 # nombres packages
|
|
1992
|
+
PREF="aaaa" # doit faire 4 caractères utilies pour générer les barecode
|
|
1993
|
+
# des packtages
|
|
1994
|
+
|
|
1995
|
+
CODE_POSTAUX=("59000", "75001") # liste code postale sur lequelle une addresse aléatoire seras choisi
|
|
1996
|
+
# (creation de la commade)
|
|
1997
|
+
DELIVERY_SLOTS=( # liste des horraires de créneau de livraison choisi aléatoirement
|
|
1998
|
+
"06:00+01:00[Europe/Paris]-08:00+01:00[Europe/Paris]"
|
|
1999
|
+
"08:00+01:00[Europe/Paris]-10:00+01:00[Europe/Paris]"
|
|
2000
|
+
"10:00+01:00[Europe/Paris]-12:00+01:00[Europe/Paris]"
|
|
2001
|
+
"16:00+01:00[Europe/Paris]-18:00+01:00[Europe/Paris]"
|
|
2002
|
+
"18:00+01:00[Europe/Paris]-20:00+01:00[Europe/Paris]"
|
|
2003
|
+
)
|
|
2004
|
+
|
|
2005
|
+
# DELIVERY_OPTIONS=("skill1" "skill2") # liste des nom skill - a décommanter
|
|
2006
|
+
|
|
2007
|
+
# normalement pas bessoin modifer
|
|
2008
|
+
ORDER_DATE=$(date '+%Y-%m-%d') # date du jour
|
|
2009
|
+
RAND=$(date +%y%m%d%H%M%S) # valueur peudo aleadoire (ici basé par date) doit faire 17 caractères
|
|
2010
|
+
BARCODE_PART=0000$RAND # utiliser pour générer les bare code les barecode sont :
|
|
2011
|
+
# {BARECODE_PART}{00000} a {BARECODE_PART}{BARECODES_COUNT}
|
|
2012
|
+
PRIMARY_REF=$PREF$RAND # primaryOrderReference de la commande
|
|
1749
2013
|
EOF
|
|
1750
2014
|
echo "éditer le fichier $SCENARIO"
|
|
1751
2015
|
return 1
|
|
@@ -1780,46 +2044,68 @@ cleanup_grouped_merged_mr() {
|
|
|
1780
2044
|
--url "https://gitlab.com/api/v4/projects/$MR"
|
|
1781
2045
|
done
|
|
1782
2046
|
}
|
|
1783
|
-
|
|
1784
|
-
# image index (docker manifest) does not have tags and images are tagged but not marked as related to the index.
|
|
1785
|
-
# Should be fixed using more complex procedure to relate index and images.
|
|
2047
|
+
|
|
1786
2048
|
# you will need jq to use these commands. You can install it using "brew install jq"
|
|
1787
|
-
#
|
|
1788
|
-
# will delete images older than
|
|
1789
|
-
|
|
2049
|
+
# cleanup_all_ecr_images 12
|
|
2050
|
+
# will delete images in all repositories older than 12 weeks
|
|
2051
|
+
# cleanup_single_ecr_repository colisweb-api 8
|
|
2052
|
+
# will delete images older than 8 weeks in the colisweb-api repository
|
|
2053
|
+
cleanup_all_ecr_images() {
|
|
2054
|
+
WEEKS=$1
|
|
1790
2055
|
|
|
1791
|
-
|
|
1792
|
-
|
|
2056
|
+
# OR to work on bash and zsh
|
|
2057
|
+
CLEAN_BEFORE=$(date -v-${WEEKS}w +%F || date --date="-${WEEKS} weeks" +'%Y-%m-%d')
|
|
2058
|
+
REPOSITORIES=$(aws ecr describe-repositories --output json | jq -r '.[] |.[].repositoryName')
|
|
1793
2059
|
|
|
1794
|
-
|
|
2060
|
+
while read -r REPOSITORY; do
|
|
2061
|
+
echo "processing ECR repository $REPOSITORY before $CLEAN_BEFORE"
|
|
2062
|
+
cleanup_single_ecr_repository "$CLEAN_BEFORE" "$REPOSITORY"
|
|
2063
|
+
done <<< "$REPOSITORIES"
|
|
2064
|
+
}
|
|
1795
2065
|
|
|
1796
|
-
|
|
1797
|
-
|
|
2066
|
+
cleanup_single_ecr_repository() {
|
|
2067
|
+
BEFORE=$1
|
|
2068
|
+
REPOSITORY=$2
|
|
1798
2069
|
|
|
1799
|
-
|
|
1800
|
-
NON_LATEST_IMAGES=$(echo $IMAGES | jq '[.imageDetails[] | select(.imageTags | any(endswith("latest")) | not)]')
|
|
2070
|
+
echo "gettings tags for repository $REPOSITORY before $BEFORE"
|
|
1801
2071
|
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
}
|
|
2072
|
+
ALL_TAGS=$(aws ecr describe-images --repository-name "$REPOSITORY" --output json |
|
|
2073
|
+
jq '.imageDetails' |
|
|
2074
|
+
jq '. |= sort_by(.imagePushedAt)' |
|
|
2075
|
+
jq --arg date $BEFORE '.[] | select(.imagePushedAt[0:10] < $date)' |
|
|
2076
|
+
jq 'select((.imageTags != null) or (.imageTags == []))' |
|
|
2077
|
+
jq 'select(.imageTags | any(endswith("latest")) | not)' |
|
|
2078
|
+
jq -r '.imageTags | join(" ")' |
|
|
2079
|
+
sort -u)
|
|
1811
2080
|
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
2081
|
+
if [ -z "${ALL_TAGS}" ]; then
|
|
2082
|
+
echo "no tag to delete for repository $REPOSITORY"
|
|
2083
|
+
else
|
|
2084
|
+
echo "deleting $(echo $ALL_TAGS | wc -l) tags for $REPOSITORY"
|
|
2085
|
+
|
|
2086
|
+
while read image_tags; do
|
|
2087
|
+
SINGLE_TAG=$(echo $image_tags | grep -o '^\S*')
|
|
2088
|
+
|
|
2089
|
+
DIGESTS_TO_DELETE=$(docker buildx imagetools inspect \
|
|
2090
|
+
949316342391.dkr.ecr.eu-west-1.amazonaws.com/$REPOSITORY:$SINGLE_TAG --raw |
|
|
2091
|
+
jq -r '[.manifests | .[].digest] | join(" imageDigest=") | "imageDigest=" + .' ||
|
|
2092
|
+
echo "")
|
|
2093
|
+
|
|
2094
|
+
TAGS_TO_DELETE=$(echo "$image_tags" | sed 's/[^ ]* */imageTag=&/g')
|
|
2095
|
+
|
|
2096
|
+
export AWS_PAGER=""
|
|
2097
|
+
|
|
2098
|
+
aws ecr batch-delete-image --repository-name "$REPOSITORY" --image-ids $(echo $TAGS_TO_DELETE) > /dev/null 2>&1
|
|
2099
|
+
test -z $DIGESTS_TO_DELETE ||
|
|
2100
|
+
aws ecr batch-delete-image --repository-name "$REPOSITORY" --image-ids $(echo $DIGESTS_TO_DELETE)> /dev/null 2>&1
|
|
2101
|
+
done <<< $ALL_TAGS
|
|
2102
|
+
|
|
2103
|
+
echo "deleted $(echo $ALL_TAGS | wc -l) tags"
|
|
2104
|
+
fi
|
|
1816
2105
|
|
|
1817
|
-
while IFS= read -r REPO; do
|
|
1818
|
-
echo "processing ECR repository $REPO"
|
|
1819
|
-
cleanup_ecr_images $REPO $1
|
|
1820
|
-
done <<< "$REPOSITORIES"
|
|
1821
2106
|
}
|
|
1822
2107
|
|
|
2108
|
+
|
|
1823
2109
|
cleanup_ci_cache() {
|
|
1824
2110
|
DATE=${1:-$(date -v-1m +%F)}
|
|
1825
2111
|
CACHE_BUCKET=${2:-"s3://gitlab-colisweb-distributed-cache/project/"}
|
|
@@ -1841,6 +2127,23 @@ cleanup_ci_cache() {
|
|
|
1841
2127
|
done < <(aws s3 ls $CACHE_BUCKET --recursive)
|
|
1842
2128
|
}
|
|
1843
2129
|
|
|
2130
|
+
cleanup_batch_definitions() {
|
|
2131
|
+
DEFINITION_NAME=$1
|
|
2132
|
+
ARNs=($(
|
|
2133
|
+
aws batch describe-job-definitions \
|
|
2134
|
+
--status ACTIVE \
|
|
2135
|
+
--job-definition-name "$DEFINITION_NAME" |
|
|
2136
|
+
jq '.jobDefinitions | sort_by(-.revision)' |
|
|
2137
|
+
jq 'del( .[0])' |
|
|
2138
|
+
jq -r '.[] | .jobDefinitionArn'
|
|
2139
|
+
)
|
|
2140
|
+
)
|
|
2141
|
+
for A in ${ARNs[@]}; do
|
|
2142
|
+
echo "deregister $A"
|
|
2143
|
+
aws batch deregister-job-definition --job-definition $A
|
|
2144
|
+
done
|
|
2145
|
+
echo "cleaned up all definitions except latest"
|
|
2146
|
+
}
|
|
1844
2147
|
#!/usr/bin/env bash
|
|
1845
2148
|
|
|
1846
2149
|
ftp_ikea_k8s() {
|
|
@@ -2296,15 +2599,15 @@ extract_yaml_config_variable() {
|
|
|
2296
2599
|
|
|
2297
2600
|
if [ ! -f ${CONFIGS_PATH}/common.yaml ]; then
|
|
2298
2601
|
echo >&2 "Missing $CONFIGS_PATH/common.yaml configuration file"
|
|
2299
|
-
|
|
2602
|
+
return 1
|
|
2300
2603
|
fi
|
|
2301
2604
|
if [ ! -f ${CONFIGS_PATH}/${ENVIRONMENT}.yaml ]; then
|
|
2302
2605
|
echo >&2 "Missing $CONFIGS_PATH/$ENVIRONMENT.yaml configuration file"
|
|
2303
|
-
|
|
2606
|
+
return 1
|
|
2304
2607
|
fi
|
|
2305
2608
|
if [ ! -f ${CONFIGS_PATH}/${ENVIRONMENT}-secrets.yaml ]; then
|
|
2306
2609
|
echo >&2 "Missing $CONFIGS_PATH/$ENVIRONMENT-secrets.yaml configuration file"
|
|
2307
|
-
|
|
2610
|
+
return 1
|
|
2308
2611
|
fi
|
|
2309
2612
|
|
|
2310
2613
|
result=$(yq -r ${VARIABLE} "$CONFIGS_PATH/$ENVIRONMENT-secrets.yaml")
|
|
@@ -2315,10 +2618,10 @@ extract_yaml_config_variable() {
|
|
|
2315
2618
|
if [ $? -ne 0 ] || [ "$result" = "null" ]; then
|
|
2316
2619
|
if [ $OPTIONAL = true ]; then
|
|
2317
2620
|
echo ""
|
|
2318
|
-
|
|
2621
|
+
return 0
|
|
2319
2622
|
else
|
|
2320
2623
|
echo >&2 "Missing path $VARIABLE in $CONFIGS_PATH/$ENVIRONMENT-secrets.yaml, $CONFIGS_PATH/$ENVIRONMENT.yaml or $CONFIGS_PATH/common.yaml"
|
|
2321
|
-
|
|
2624
|
+
return 1
|
|
2322
2625
|
fi
|
|
2323
2626
|
fi
|
|
2324
2627
|
fi
|
|
@@ -2591,7 +2894,7 @@ deploy_chart() {
|
|
|
2591
2894
|
if [ ! -d ${root_path}/${path_chart} ] || [ ! -f ${root_path}/${path_chart}/Chart.yaml ]; then
|
|
2592
2895
|
echo "Bad Chart $root_path/$path_chart : does not exists or missing Chart.yaml"
|
|
2593
2896
|
print_usage
|
|
2594
|
-
|
|
2897
|
+
return 1
|
|
2595
2898
|
fi
|
|
2596
2899
|
|
|
2597
2900
|
# Unset Kubectl configuration made via the KUBECONFIG env variable
|
|
@@ -2674,7 +2977,7 @@ verify_deployments() {
|
|
|
2674
2977
|
|
|
2675
2978
|
if [ $? -ne 0 ]; then
|
|
2676
2979
|
echo "at least one deployment failed or timed out (after $TIMEOUT)"
|
|
2677
|
-
|
|
2980
|
+
return 1
|
|
2678
2981
|
fi
|
|
2679
2982
|
done
|
|
2680
2983
|
|
|
@@ -2697,7 +3000,7 @@ check_config_file() {
|
|
|
2697
3000
|
if [ ! -f ${filename} ]; then
|
|
2698
3001
|
echo "Missing $filename configuration file"
|
|
2699
3002
|
print_usage
|
|
2700
|
-
|
|
3003
|
+
return 1
|
|
2701
3004
|
fi
|
|
2702
3005
|
}
|
|
2703
3006
|
|
|
@@ -2922,7 +3225,7 @@ emit_datadog_deploy_event() {
|
|
|
2922
3225
|
echo "event successfully created check in datadog UI : $url"
|
|
2923
3226
|
else
|
|
2924
3227
|
echo " failed to create event "
|
|
2925
|
-
|
|
3228
|
+
return 1
|
|
2926
3229
|
fi
|
|
2927
3230
|
}
|
|
2928
3231
|
|