Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
Dockerfiles
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Picasoft
Technique
Dockerfiles
Commits
0d38eb29
Verified
Commit
0d38eb29
authored
5 years ago
by
Guillaume Damiens
Browse files
Options
Downloads
Patches
Plain Diff
Ajout requête de suppression boards anciens + renommage variables
parent
c3cb4605
No related branches found
Branches containing commit
No related tags found
1 merge request
!37
Tx services p19 test
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
pica-wekan/policy.sh
+12
-5
12 additions, 5 deletions
pica-wekan/policy.sh
with
12 additions
and
5 deletions
pica-wekan/policy.sh
+
12
−
5
View file @
0d38eb29
...
...
@@ -3,20 +3,24 @@
.
ids.sh
# contient $username et $password pour authentification
# Paramètres
boardExpirationDurationMonth
=
12
deadlineTimeStamp
=
$(
date
-d
"-"
$boardExpirationDurationMonth
"months"
+%s
)
boardExpirationDurationYears
=
10
# années
boardExpirationDurationMonths
=
# mois
boardExpirationDurationDays
=
0
# jours
# Deadline = somme des durées du dessus
deadlineTimeStamp
=
$(
date
-d
"-"
$boardExpirationDurationYears
"years-"
$boardExpirationDurationMonths
"months-"
$boardExpirationDurationDays
"days"
+%s
)
queryPica
=
$(
curl
-s
https://wekan.test.picasoft.net/users/login
-d
'username='
"
$username
"
'&password='
"
$password
"
''
)
token
=
$(
echo
$queryPica
| jq
-r
.token
)
tokenExpirationDate
=
$(
echo
$queryPica
| jq
-r
.tokenExpires
)
# condition à rajouter sur la date d'expiration du token : arrêt si trop ancien
# récupération des ids de tous les boards publics
idBoards
=
$(
curl
-s
-X
GET https://wekan.test.picasoft.net/api/boards
\
-H
'Accept: application/json'
\
-H
'Authorization: Bearer '
"
$token
"
''
| jq
-r
'.[]._id'
)
# affiche les boards publics qui n'ont pas été modifié depuis
# affiche les boards publics qui n'ont pas été modifié depuis
deadlineTimeStamp
for
idBoard
in
$idBoards
do
board
=
$(
curl
-s
-X
GET https://wekan.test.picasoft.net/api/boards/
$idBoard
\
...
...
@@ -32,7 +36,10 @@ do
if
[
$((
$deadlineTimeStamp
-
$(
date
-d
$lastModificationDate
+%s
)
))
-gt
0
]
then
echo
"deadline plus récente que date de modif : board "
$idBoard
" à supprimer"
# board à supprimer
# echo "deadline plus récente que date de modif : board "$idBoard" à supprimer"
echo
"plus récent : on supprime"
$idBoard
curl
-X
DELETE https://wekan.test.picasoft.net/api/boards/
$idBoard
\
-H
'Authorization: Bearer '
"
$token
"
''
fi
done
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