UNCLASSIFIED
Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
Ironbank Tools
project-template
Commits
562edddb
Commit
562edddb
authored
May 07, 2021
by
Joshua Eason
Browse files
Removing badge support
parent
c85056c9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
40 deletions
+11
-40
modules/badges.py
modules/badges.py
+3
-32
template.py
template.py
+8
-8
No files found.
modules/badges.py
View file @
562edddb
...
...
@@ -4,13 +4,7 @@ import json
import
urllib.parse
import
re
link_ibfe
=
"https://ironbank.dsop.io/ironbank/repomap/"
link_registry1
=
"https://registry1.dsop.io/harbor/projects/3/repositories/"
link_pipeline
=
"https://repo1.dsop.io/"
image_ibfe
=
"https://img.shields.io/badge/Website-Iron%20Bank-informational"
image_registry1
=
"https://img.shields.io/badge/Website-Registry1-informational"
image_pipeline
=
"https://repo1.dsop.io/"
##### Supporting methods
...
...
@@ -74,14 +68,7 @@ def __createBadge(url, token, id, badge, project):
'image_url'
:
''
}
if
badge
[
'name'
]
==
'ibfe'
:
PARAMS
[
'link_url'
]
=
link_ibfe
+
project
PARAMS
[
'link_url'
]
=
re
.
search
(
"(.*)/"
,
PARAMS
[
'link_url'
]).
group
(
1
)
PARAMS
[
'image_url'
]
=
image_ibfe
elif
badge
[
'name'
]
==
'registry1'
:
PARAMS
[
'link_url'
]
=
link_registry1
+
project
.
replace
(
"/"
,
"%2F"
)
PARAMS
[
'image_url'
]
=
image_registry1
elif
badge
[
'name'
]
==
'pipeline'
:
if
badge
[
'name'
]
==
'pipeline'
:
PARAMS
[
'link_url'
]
=
link_pipeline
+
"dsop/"
+
project
+
"/-/pipelines"
PARAMS
[
'image_url'
]
=
image_pipeline
+
"dsop/"
+
project
+
"/badges/master/pipeline.svg"
else
:
...
...
@@ -104,14 +91,7 @@ def __fixBadge(url, token, id, badge, project):
'image_url'
:
''
}
if
badge
[
'name'
]
==
'ibfe'
:
PARAMS
[
'link_url'
]
=
link_ibfe
+
project
PARAMS
[
'link_url'
]
=
re
.
search
(
"(.*)/"
,
PARAMS
[
'link_url'
]).
group
(
1
)
PARAMS
[
'image_url'
]
=
image_ibfe
elif
badge
[
'name'
]
==
'registry1'
:
PARAMS
[
'link_url'
]
=
link_registry1
+
project
.
replace
(
"/"
,
"%2F"
)
PARAMS
[
'image_url'
]
=
image_registry1
elif
badge
[
'name'
]
==
'pipeline'
:
if
badge
[
'name'
]
==
'pipeline'
:
PARAMS
[
'link_url'
]
=
link_pipeline
+
"dsop/"
+
project
+
"/-/pipelines"
PARAMS
[
'image_url'
]
=
image_pipeline
+
"dsop/"
+
project
+
"/badges/master/pipeline.svg"
else
:
...
...
@@ -160,9 +140,6 @@ def checkMissing(tbadges, pbadges):
return
notFound
def
checkMisconfigured
(
tbadges
,
pbadges
,
project
):
ibfe_link_url
=
link_ibfe
+
project
ibfe_link_url
=
re
.
search
(
"(.*)/"
,
ibfe_link_url
).
group
(
1
)
registry1_link_url
=
link_registry1
+
project
.
replace
(
"/"
,
"%2F"
)
pipeline_link_url
=
link_pipeline
+
"dsop/"
+
project
+
"/-/pipelines"
pipeline_image_url
=
image_pipeline
+
"dsop/"
+
project
+
"/badges/master/pipeline.svg"
...
...
@@ -173,13 +150,7 @@ def checkMisconfigured(tbadges, pbadges, project):
if
a
[
'kind'
]
==
'project'
:
for
b
in
pbadges
:
if
a
[
'name'
]
==
b
[
'name'
]
and
b
[
'kind'
]
==
'project'
:
if
b
[
'name'
]
==
"ibfe"
:
if
b
[
'link_url'
]
!=
ibfe_link_url
or
b
[
'image_url'
]
!=
image_ibfe
:
miss
=
True
elif
b
[
'name'
]
==
"registry1"
:
if
b
[
'link_url'
]
!=
registry1_link_url
or
b
[
'image_url'
]
!=
image_registry1
:
miss
=
True
elif
b
[
'name'
]
==
"pipeline"
:
if
b
[
'name'
]
==
"pipeline"
:
if
b
[
'link_url'
]
!=
pipeline_link_url
or
b
[
'image_url'
]
!=
pipeline_image_url
:
miss
=
True
else
:
...
...
template.py
View file @
562edddb
...
...
@@ -144,11 +144,11 @@ def main(argv):
if
'branches'
in
runModules
:
branches
.
check
(
gitlab_url
,
gitlab_token
,
projectTemplate
,
i
[
'id'
])
if
'badges'
in
runModules
:
badges
.
check
(
gitlab_url
,
gitlab_token
,
projectTemplate
,
i
[
'id'
])
#
if 'badges' in runModules:
#
badges.check(gitlab_url, gitlab_token, projectTemplate, i['id'])
if
'approval_badges'
in
runModules
:
approval_badges
.
check
(
gitlab_url
,
gitlab_token
,
i
[
'id'
])
# #
if 'approval_badges' in runModules:
# #
approval_badges.check(gitlab_url, gitlab_token, i['id'])
elif
mode
==
'fix'
:
if
'projects'
in
runModules
:
projects
.
fix
(
gitlab_url
,
gitlab_token
,
projectTemplate
,
i
[
'id'
])
...
...
@@ -163,11 +163,11 @@ def main(argv):
if
'branches'
in
runModules
:
branches
.
fix
(
gitlab_url
,
gitlab_token
,
projectTemplate
,
i
[
'id'
])
if
'badges'
in
runModules
:
badges
.
fix
(
gitlab_url
,
gitlab_token
,
projectTemplate
,
i
[
'id'
])
#
if 'badges' in runModules:
#
badges.fix(gitlab_url, gitlab_token, projectTemplate, i['id'])
if
'approval_badges'
in
runModules
:
approval_badges
.
fix
(
gitlab_url
,
gitlab_token
,
i
[
'id'
])
#
if 'approval_badges' in runModules:
#
approval_badges.fix(gitlab_url, gitlab_token, i['id'])
else
:
logging
.
critical
(
"Unsupported mode of operation!"
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment