Skip to content

Commit 8a788f3

Browse files
committed
add troubleshooting section
1 parent 579f6aa commit 8a788f3

10 files changed

+55
-22
lines changed

README.md

Lines changed: 54 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -49,18 +49,27 @@ Before you begin, ensure you have the following:
4949

5050
- **Prisma Cloud Defender Agent Deployed on K8s Cluster:** The Prisma Cloud Defender agent should be deployed on your Kubernetes cluster and connected to the Prisma Cloud tenant. This ensures that Prisma Cloud can monitor and protect your deployed applications.
5151

52-
## Step-by-Step Procedure
52+
- Create your own GitHub Organization
53+
1. Go to [GitHub](https://github.com/).
54+
1. In the upper-right corner of any page on GitHub, click your profile photo, then click Settings.
55+
1. In the "Access" section of the sidebar, click Organizations.
56+
1. Next to the "Organizations" header, click New organization.
57+
5358

54-
### Fork this Repository
59+
## Step-by-Step Procedure
5560

56-
Click the "Fork" button in the top-right corner to create your own copy of the repository.
61+
### Download the code source
62+
63+
Go to the repository: https://github.com/PaloAltoNetworks/code2cloud-python-flask-webserver.
64+
Download the code in ZIP format
65+
![Download the code in ZIP format](docs/download-source-code.png)
5766

58-
### Enable Workflows for the Forked Repository
67+
### Create a new repository in your organization
5968

60-
- Go to https://github.com/<your-github-username>/code2cloud-python-flask-webserver/actions/
61-
- Click on `Enable Workflows` button
69+
Make sure to select your organization as the owner of the new repository:
70+
![Create new repository](docs/create-new-repo.png)
6271

63-
### Onboard the Forked Repository in Prisma Cloud
72+
### Onboard the New Repository in Prisma Cloud
6473

6574
Follow the instructions in the Prisma Cloud documentation to connect your GitHub repository:
6675
[Add GitHub Repository to Prisma Cloud](https://docs.prismacloud.io/en/classic/appsec-admin-guide/get-started/connect-your-repositories/code-repositories/add-github)
@@ -69,13 +78,15 @@ Follow the instructions in the Prisma Cloud documentation to connect your GitHub
6978

7079
Clone your forked repository to your local machine:
7180
```bash
72-
git clone https://github.com/<your-github-username>/code2cloud-python-flask-webserver.git
81+
git clone https://github.com/<your-github-organization>/code2cloud-python-flask-webserver.git
7382
```
7483

75-
### Change the Version Number
76-
Change the directory to the cloned repository:
84+
### Push the code on the new repository
85+
86+
Unzip the code source to a new directory on your local machine.
87+
Change the directory and open repository:
7788

78-
```console
89+
```bash
7990
cd code2cloud-python-flask-webserver
8091
```
8192

@@ -86,17 +97,22 @@ version = "0.0.10" # Update to a new version number
8697

8798
Open the `manifests/deployment.yaml` file and update the container repository name and the version number:
8899
```yaml
89-
image: ghcr.io/<your-github-username>/code2cloud-python-flask-webserver:v0.0.10 # Update the ontainer repository name with your github username and the version number
100+
image: ghcr.io/<your-github-organization>/code2cloud-python-flask-webserver:v0.0.10 # Update the ontainer repository name with your github username and the version number
90101
```
91102
92-
### Push the changes to the Repository
93-
103+
Initializes a git repository, commits your code, creates the main branch, sets up a remote repository on GitHub, and pushes your code to it.
94104
```bash
95-
git add version.py
96-
git commit -m "Update version number to 0.0.10"
97-
git push origin main
105+
git init
106+
git add .
107+
git commit -m "first commit"
108+
git branch -M main
109+
git remote add origin [email protected]:<your-github-organization>/org-code2cloud-python-flask-webserver.git
110+
git push -u origin main
98111
```
99112

113+
The push will trigger the GitHub Actions pipeline, which will build the container image and push it to GHCR.
114+
![Trigger the CI](docs/trigger-ci.png)
115+
100116
### Create a PAT (Personal Access Token) Token
101117
- Go to your GitHub account settings.
102118
- Navigate to "Developer settings" and then "Personal access tokens."
@@ -114,7 +130,7 @@ Use the PAT token to create a Docker registry secret:
114130
```bash
115131
kubectl create secret docker-registry ghcr-io-creds \
116132
--docker-server=ghcr.io \
117-
--docker-username=<your-github-username> \
133+
--docker-username=<your-github-organization> \
118134
--docker-password=<your_pat_token> \
119135
--docker-email=<your-github-email>
120136
```
@@ -130,8 +146,25 @@ Verify the service is created and accessible:
130146
kubectl get svc -n code2cloud
131147
```
132148

133-
### Access the Application
149+
### Access the Web Application
134150
Use the external IP provided by the LoadBalancer service to access the application in your browser.
135151

136-
## Conclusion
137-
By following these steps, you have successfully demonstrated the code-to-cloud traceability feature of Prisma Cloud using a Python Flask application. The application is now deployed on a Kubernetes cluster, showcasing automated CI/CD with GitHub Actions and Docker.
152+
![Web Application](docs/webapp.png)
153+
154+
### Troubleshooting by verifying the HASH
155+
156+
Go to https://github.com/<your-github-organization>/code2cloud-python-flask-webserver/actions/
157+
Click on latest action and expand the Output image digest step as you can see below:
158+
![Digest from the logs](docs/digest-logs.png)
159+
160+
Go to home page of you repository and click on the Packages: https://github.com/<your-github-organization>/code2cloud-python-flask-webserver
161+
![Packages of thge repository](docs/repo-packages.png)
162+
163+
Expand the latest version to verify the digest from the previous step:
164+
![Digest from GHCR](docs/digest-ghcr.png)
165+
166+
Connect to your Prisma Cloud tenant and search for code2cloud from Runtime Security > Monitor > Vulnerabilities > Images > Deployed, click on the image that was deployed on your kubernetes cluster and verify the hash from previous step:
167+
![Digest from Prisma Cloud](docs/digest-prisma-cloud.png)
168+
169+
## END
170+

docs/create-new-repo.png

164 KB
Loading

docs/digest-ghcr.png

183 KB
Loading

docs/digest-logs.png

358 KB
Loading

docs/digest-prisma-cloud.png

236 KB
Loading

docs/download-source-code.png

200 KB
Loading

docs/repo-packages.png

386 KB
Loading

docs/trigger-ci.png

155 KB
Loading

docs/webapp.png

63.8 KB
Loading

manifests/deployment.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ spec:
2525
spec:
2626
containers:
2727
- name: code2cloud-python-flask-webserver
28-
image: ghcr.io/<your-github-username>/code2cloud-python-flask-webserver:v0.0.9 # Update the repo container repository name with your github username and the version number
28+
image: ghcr.io/<your-github-organization>/code2cloud-python-flask-webserver:v0.0.9 # Update the repo container repository name with your github username and the version number
2929
ports:
3030
- containerPort: 5000
3131
readinessProbe:

0 commit comments

Comments
 (0)