Skip to content

Commit 1b85e6b

Browse files
DEVOPS-263 updated readme
1 parent 417d737 commit 1b85e6b

File tree

5 files changed

+35
-8
lines changed

5 files changed

+35
-8
lines changed

README.md

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ This app helps in displaying image details available in an azure container regis
99
that belongs to other teams.
1010

1111
* As an example there is a platform engineering team that maintains docker imagges which are widely used and frequeently built,
12-
and if teams wont have access to the registry they won't be able to list out the differnt versions of images available.
12+
and if teams won't have access to the registry they won't be able to list out the differnt versions of images available.
1313

1414
➦ This application can resolve above mentioned problem.
1515

@@ -28,6 +28,32 @@ This app helps in displaying image details available in an azure container regis
2828
* Microsoft Azure Container Registry Client Library for Python is used to list all images and tags in a ACR.
2929
[azure-containerregistry](https://learn.microsoft.com/en-us/python/api/overview/azure/containerregistry-readme?view=azure-python)
3030

31+
* Microsoft Azure Resource Graph Client Library [azure-mgmt-resourcegraph](https://learn.microsoft.com/en-us/python/api/azure-mgmt-resourcegraph/azure.mgmt.resourcegraph?view=azure-python)
32+
used to list the containers to verify and validate the user input container name.
33+
34+
# Architecture diagram
35+
![app-to-get-image-details-from-acr.jpg](app-to-get-image-details-from-acr.jpg)
36+
37+
* User access the streamlit app. inputs an acr name
38+
39+
* The user input is passed from streamlit ui to python program as an input.
40+
41+
* Python program lists all containers available in azure using resource graph query and checks if the input is valid
42+
43+
```mermaid
44+
flowchart TD
45+
A[User Input] -->B[Submit]
46+
B --> C{Python program}
47+
C -->|Valid user input| D[proceeds to retrieve image details]
48+
C -->|Invalid user input| E[Throws error]
49+
```
50+
51+
* If the user input which is a acr name is wrong, gets the below error
52+
53+
![wrong-acr-name-error.jpeg](wrong-acr-name-error.jpeg)
54+
55+
56+
3157

3258

3359

acr_images.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
from azure.identity import DefaultAzureCredential, EnvironmentCredential
77
from azure.containerregistry import ContainerRegistryClient
88
from date_time import date_time
9-
from azure_resource_graph_query import validate_input_acr_name
109
from azure.core.exceptions import HttpResponseError, ClientAuthenticationError
1110

1211

@@ -26,15 +25,15 @@ def list_image_tag_details(acr_name: str):
2625
:param acr_name:
2726
:return:
2827
"""
28+
from azure_resource_graph_query import validate_input_acr_name
2929
credential = EnvironmentCredential()
30+
# validate acr input
31+
valid = validate_input_acr_name(acr_name=acr_name)
3032

3133
repositories = get_image_names_from_acr(acr_name=acr_name)
3234
acr_url = return_acr_endpoint(acr_name=acr_name)
33-
print(f'Image details will be fetched from : {acr_url}')
34-
# validate acr input
35-
valid = validate_input_acr_name(acr_name=acr_name)
35+
# print(f'Image details will be fetched from : {acr_url}')
3636

37-
# Image - tag count
3837
image_tag_count = {}
3938
client = ContainerRegistryClient(endpoint=acr_url, credential=credential)
4039
for repository in repositories:
53.8 KB
Loading

azure_resource_graph_query.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,9 @@ def validate_input_acr_name(acr_name: str):
4949
print(f"{acr} is valid.")
5050
else:
5151
print(f"ACR {acr} can not be found in azure")
52-
st.text(f"ACR {acr} can not be found in azure 🚫")
52+
# displaying error in streamlit ui
53+
st.text(f"Azure container resistry with name '{acr}' can not be found in azure 🚫")
54+
st.text(f"Please verify & provide right ACR name")
5355
sys.exit(f"Error: ACR {acr} can not be found in azure")
5456
return False
5557

@@ -61,7 +63,7 @@ def main():
6163
"""
6264
load_dotenv()
6365
logging.info("ARG query being prepared......")
64-
run_azure_rg_query(subscription_name="TECH-ARCHITECTS-NONPROD")
66+
acr = run_azure_rg_query()
6567
logging.info("ARG query Completed......")
6668

6769

wrong-acr-name-error.jpeg

92.4 KB
Loading

0 commit comments

Comments
 (0)