-
Notifications
You must be signed in to change notification settings - Fork 4
/
script.py
81 lines (55 loc) · 2.67 KB
/
script.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
import lib.ImageTagAutomation as ITA
import lib.ReadmeGeneration as RG
import lib.FetchLicense as FL
import argparse
import requests
def main(line, usernameStrGithub , passwordStrGithub):
try:
image_name, folder_name = line.strip().split(',')
folder_name = folder_name[0] + "/" + folder_name
#print( folder_name )
github_url = "https://raw.githubusercontent.com/ppc64le/build-scripts/master/"+ folder_name +"/license_list.csv"
#print(github_url)
folder_name = folder_name[:folder_name.index('/Dockerfiles')]
#print(folder_name)
print("\n Getting image tags..")
tag_list = ITA.get_image_tags_from_dockerhub(image_name, registry="ibmcom")
#print(tag_list)
if tag_list:
print(" Getting dockerfile links..")
dict_tag_links_on_github, usage_text, remaining_tags, maintainer, source= ITA.get_tag_links_from_github(tag_list, folder_name, usernameStrGithub, passwordStrGithub)
'''
for key , value in dict_tag_links_on_github.items():
print(" Key: ", key)
print(" Value: ", value)
print(remaining_tags)
'''
for tag in remaining_tags:
dict_tag_links_on_github[tag] = "https://github.com/ppc64le/build-scripts/blob/master/"+folder_name+"/Dockerfiles"
remaining_tags = []
print(" Generating readme file..")
RG.set_file_name(image_name)
RG.clear_file()
RG.add_supported_tags_tab(dict_tag_links_on_github, remaining_tags)
RG.add_maintainer_tab(maintainer)
RG.add_source_tab(source)
RG.add_usage_tab(usage_text)
license_list = FL.fetch_license( github_url )
#print(license_list)
if license_list!=False:
RG.add_license_tag(license_list)
else:
print( " Error in fetching license form github... Uploading without license info.. " )
license_list = []
RG.add_license_tag(license_list)
RG.add_disclaimer_tab()
else:
print(" No tags found for the image.. Cannot create README.md file")
return "docker"
except TypeError as e:
print(e)
print("Github api access limit exceeded.. Try after one hour")
return "github"
except Exception as e:
print(e)
return "docker"