Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

manoj pull update #49

Open
wants to merge 69 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
6d30279
Create openshift.yml
devopscicd17 Jul 28, 2022
56aa8f7
Update openshift.yml
devopscicd17 Jul 28, 2022
9ee3c2b
Update script.sh
devopscicd17 Aug 2, 2022
8ab6668
Update openshift.yml
devopscicd17 Aug 2, 2022
ca4a8d6
Update openshift.yml
devopscicd17 Aug 2, 2022
a1b8da8
Update openshift.yml
devopscicd17 Aug 2, 2022
8fd6219
Update openshift.yml
devopscicd17 Aug 2, 2022
15f5e95
Update openshift.yml
devopscicd17 Aug 2, 2022
a5b5c89
Update openshift.yml
devopscicd17 Aug 2, 2022
13b798c
Update openshift.yml
devopscicd17 Aug 3, 2022
a39a50a
Update openshift.yml
devopscicd17 Aug 3, 2022
29173e5
Update README.adoc
devopscicd17 Aug 4, 2022
5ef82c4
Update README.adoc
devopscicd17 Aug 22, 2022
9cdb616
Update openshift.yml
devopscicd17 Aug 22, 2022
3f13721
Update README.adoc
devopscicd17 Sep 8, 2022
5c75fa5
Update PIPELINE.md
devopscicd17 Sep 30, 2022
00159de
Update PIPELINE.md
devopscicd17 Sep 30, 2022
c8a1398
Update README.adoc
devopscicd17 Nov 14, 2022
ce4c38d
Update README.adoc
devopscicd17 Nov 29, 2022
ec2d133
Update README.adoc
devopscicd17 Mar 21, 2023
431a97c
Update README.adoc
devopscicd17 Mar 21, 2023
fd93d6d
Update README.adoc
devopscicd17 May 24, 2023
3bf9652
Update README.adoc
devopscicd17 Jun 7, 2023
84f4e91
Update README.adoc
devopscicd17 Jul 10, 2023
5780650
Update README.adoc
devopscicd17 Aug 3, 2023
8740308
Update README.adoc
devopscicd17 Aug 31, 2023
2c1de50
Update README.adoc
devopscicd17 Sep 30, 2023
19e7da7
Update script.sh
devopscicd17 Sep 30, 2023
23ece46
Update script.sh
devopscicd17 Sep 30, 2023
2ddde6a
Update README.adoc
devopscicd17 Oct 6, 2023
5cc9fc6
Update script.sh
devopscicd17 Oct 6, 2023
b2f4ccc
Update README.adoc
devopscicd17 Jan 17, 2024
911b88c
Update script.sh
devopscicd17 Jan 17, 2024
d708f29
Update README.adoc
devopscicd17 Mar 19, 2024
6e6953b
Update README.adoc
devopscicd17 Oct 17, 2024
33919dd
Merge branch 'openshift-roadshow:master' into master
devopscicd17 Oct 17, 2024
13b3fa7
Update README.adoc
devopscicd17 Oct 17, 2024
4820ce3
Update README.adoc
devopscicd17 Oct 23, 2024
40d2b9b
Create docker-image.yml
devopscicd17 Oct 28, 2024
9df7aef
Update docker-image.yml
devopscicd17 Oct 28, 2024
5665893
Delete .github/workflows directory
devopscicd17 Oct 28, 2024
8e0a7ba
Create docker-image.yml
devopscicd17 Oct 28, 2024
faf6d41
Update README.adoc
devopscicd17 Oct 28, 2024
20dc7e0
Delete .github/workflows directory
devopscicd17 Oct 28, 2024
d4a9149
Add files via upload
devopscicd17 Oct 28, 2024
acc7859
Create OpenShift.yml
devopscicd17 Oct 28, 2024
34a7451
Update OpenShift.yml
devopscicd17 Nov 1, 2024
5e9a42b
Update OpenShift.yml
devopscicd17 Nov 1, 2024
e5516d3
Update OpenShift.yml
devopscicd17 Nov 1, 2024
8f09551
Update OpenShift.yml
devopscicd17 Nov 1, 2024
36a473b
Update OC Depoly and PRISMA Scan.yml
devopscicd17 Nov 1, 2024
61325e8
Update OpenShift.yml
devopscicd17 Nov 1, 2024
9aca03d
Update OpenShift.yml
devopscicd17 Nov 1, 2024
4cb8334
Update OpenShift.yml
devopscicd17 Nov 1, 2024
b63e11e
Update OpenShift.yml
devopscicd17 Nov 1, 2024
97d5029
Update OpenShift.yml
devopscicd17 Nov 1, 2024
4e7abea
Update README.adoc
devopscicd17 Nov 12, 2024
ea647ce
Update OpenShift.yml
devopscicd17 Nov 12, 2024
0c7b48d
Update README.adoc
devopscicd17 Nov 12, 2024
385c2b9
Update OpenShift.yml
devopscicd17 Nov 12, 2024
0dff794
Delete .github/workflows directory
devopscicd17 Nov 12, 2024
3ca840f
Create OpenshiftDeploy.yml
devopscicd17 Nov 12, 2024
44f4652
Update OpenshiftDeploy.yml
devopscicd17 Nov 12, 2024
1a16603
Update OpenshiftDeploy.yml
devopscicd17 Nov 12, 2024
edfe34f
Update OpenshiftDeploy.yml
devopscicd17 Nov 12, 2024
e7583b4
Update OpenshiftDeploy.yml
devopscicd17 Nov 12, 2024
957b451
Update OpenshiftDeploy.yml
devopscicd17 Nov 12, 2024
74b990a
Update OpenshiftDeploy.yml
devopscicd17 Nov 12, 2024
a927b00
Update OpenshiftDeploy.yml
devopscicd17 Nov 12, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 82 additions & 0 deletions .github/openshift.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
name: OpenShift

env:
IMAGE_REGISTRY: ghcr.io/${{ github.repository_owner }}
REGISTRY_USER: ${{ github.actor }}
REGISTRY_PASSWORD: ${{ github.token }}
APP_NAME: nationalparks
IMAGE_TAGS: latest ${{ github.sha }}

OPENSHIFT_SERVER: ${{ secrets.OPENSHIFT_SERVER }}
OPENSHIFT_TOKEN: ${{ secrets.OPENSHIFT_TOKEN }}
OPENSHIFT_NAMESPACE: "manoj-singh8-dev"

pcc_console_url: ${{ secrets.PCC_CONSOLE_URL }}
pcc_user: ${{ secrets.PCC_USER }}
pcc_pass: ${{ secrets.PCC_PASS }}

APP_PORT: "8080"

on:
# https://docs.github.com/en/free-pro-team@latest/actions/reference/events-that-trigger-workflows
push:
branches: [ master ]

jobs:
build-and-push:
name: Build and push to github container registry
runs-on: ubuntu-22.04
environment: development

outputs:
ROUTE: ${{ steps.deploy-and-expose.outputs.route }}
SELECTOR: ${{ steps.deploy-and-expose.outputs.selector }}

steps:
- name: Checkout
id: checkout
uses: actions/checkout@v2

# https://github.com/redhat-actions/s2i-build#readme
- name: S2I Build
id: build_image
uses: redhat-actions/s2i-build@v2
with:
path_context: '.'
builder_image: 'registry.access.redhat.com/ubi8/openjdk-11'
image: ${{ env.APP_NAME }}
tags: ${{ env.IMAGE_TAGS }}

# https://github.com/redhat-actions/push-to-registry#readme
- name: Push to Registry
id: push-to-registry
uses: redhat-actions/push-to-registry@v2
with:
image: ${{ steps.build_image.outputs.image }}
tags: ${{ steps.build_image.outputs.tags }}
registry: ${{ env.IMAGE_REGISTRY }}
username: ${{ env.REGISTRY_USER }}
password: ${{ env.REGISTRY_PASSWORD }}

# The path the image was pushed to is now stored in ${{ steps.push-to-registry.outputs.registry-path }}

# https://github.com/redhat-actions/oc-login#readme
- name: Log in to OpenShift
uses: redhat-actions/oc-login@v1
with:
openshift_server_url: ${{ env.OPENSHIFT_SERVER }}
openshift_token: ${{ env.OPENSHIFT_TOKEN }}
insecure_skip_tls_verify: true
namespace: ${{ env.OPENSHIFT_NAMESPACE }}

# Run a script to create a new app or update the current one with the previously pushed container image
- run: |
"${GITHUB_WORKSPACE}/.github/script.sh" ${{ env.APP_NAME }} ${{ env.IMAGE_REGISTRY }}/${{ steps.build_image.outputs.image }}:${{ github.sha }} ${{ env.OPENSHIFT_NAMESPACE }}
# Run Prisma Scan IBM Account
- name: Scan image
uses: PaloAltoNetworks/prisma-cloud-scan@v1
with:
pcc_console_url: ${{ secrets.PCC_CONSOLE_URL }}
pcc_user: ${{ secrets.PCC_USER }}
pcc_pass: ${{ secrets.PCC_PASS }}
image_name: ${{ env.APP_NAME }}
6 changes: 3 additions & 3 deletions .github/script.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/bin/bash

app_name=$1
image=$2
namespace=$3
app_name=nationalparks
image=nationalparks
namespace=manoj-singh8-dev

deploy=`oc get deployment $app_name -n $namespace`
if [[ "$?" -eq 0 ]]; then
Expand Down
94 changes: 94 additions & 0 deletions .github/workflows/OpenshiftDeploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
name: OpenShift Deployment and Prisma Scan

on:
push:
branches: [ master]

jobs:
build-and-deploy:
name: Build, Push, Deploy to OpenShift, and Scan
runs-on: ubuntu-22.04
environment: development # Set the environment to 'development'

steps:
- name: Checkout Code
uses: actions/checkout@v2

- name: Build with Maven
run: mvn clean package # Or use ./gradlew build for Gradle

- name: Set up QEMU
uses: docker/setup-qemu-action@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Log in to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io/${{ github.repository_owner }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }} # Use environment secret

- name: Build and Push Docker Image
id: build-and-push
uses: docker/build-push-action@v4
with:
context: .
file: ./Dockerfile
tags: |
ghcr.io/${{ github.repository_owner }}/nationalparks:latest
ghcr.io/${{ github.repository_owner }}/nationalparks:${{ github.sha }}
push: true

deploy:
name: Deploy to OpenShift and Run Prisma Scan
runs-on: ubuntu-latest
environment: development # Set the environment to 'development'

env:
APP_NAME: nationalparks-new
IMAGE_REGISTRY: my-registry-url
OPENSHIFT_NAMESPACE: manoj-singh8-dev
OPENSHIFT_SERVER: https://api.sandbox-m3.1530.p1.openshiftapps.com:6443
OPENSHIFT_TOKEN: sha256~nL8HZTc43467qXnWYhYJPnAOEP0CywTJOE422kL-b3Q
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Set up OpenShift CLI
run: |
curl -LO https://mirror.openshift.com/pub/openshift-v4/clients/ocp/stable/openshift-client-linux.tar.gz
tar -xzf openshift-client-linux.tar.gz -C /usr/local/bin/
oc version

- name: Login to OpenShift
env:
OPENSHIFT_TOKEN: sha256~nL8HZTc43467qXnWYhYJPnAOEP0CywTJOE422kL-b3Q # Use environment secret
run: |
if [ -z "$OPENSHIFT_TOKEN" ]; then
echo "OpenShift token is not set."
exit 1
fi
oc login "${{ env.OPENSHIFT_SERVER }}" --token="$OPENSHIFT_TOKEN" --insecure-skip-tls-verify

- name: Build and push image to OpenShift registry
run: |
IMAGE="${{ env.IMAGE_REGISTRY }}/${{ env.OPENSHIFT_NAMESPACE }}/${{ env.APP_NAME }}:${{ github.sha }}"
docker build -t "$IMAGE" .
docker push "$IMAGE"

- name: Deploy to OpenShift
run: |
bash "${GITHUB_WORKSPACE}/.github/script.sh" \
"${{ env.APP_NAME }}" \
"${{ env.IMAGE_REGISTRY }}/${{ env.OPENSHIFT_NAMESPACE }}/${{ env.APP_NAME }}:${{ github.sha }}" \
"${{ env.OPENSHIFT_NAMESPACE }}"

- name: Prisma Cloud Scan
uses: PaloAltoNetworks/prisma-cloud-scan@v1
with:
pcc_console_url: ${{ secrets.PCC_CONSOLE_URL }} # Use environment secret
pcc_user: ${{ secrets.PCC_USER }} # Use environment secret
pcc_pass: ${{ secrets.PCC_PASS }} # Use environment secret
image_name: ${{ env.IMAGE_REGISTRY }}/${{ env.APP_NAME }}:${{ github.sha }}
1 change: 1 addition & 0 deletions PIPELINE.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,3 +147,4 @@ in the same project as Jenkins. This will contain the `master` branch of each pr
to each repository will result in a new pipeline getting instantiated and a new project getting created
for that pipeline. The GitHub PR will then include a status of the build, a link to the application preview,
and a link to the approval page.

13 changes: 11 additions & 2 deletions README.adoc
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
= NationalParks backend application
This application is a backend that provides geolocation information about NationalParks. The information is stored in a mongodb


This application is a backend that provides geolocation information about NationalParks. The information is stored in a mongodb

Hello DevD
== Installation
As the application needs to interact with openshift's API, you'll need to provide some permissions to the default ServiceAccount for that.

Expand Down Expand Up @@ -30,7 +32,7 @@ There's some options that can be parameterized:
* MAVEN_MIRROR_URL: Url of a maven mirror
* APPLICATION_HOSTNAME: Hostname/route to access your application

Example:
Example: Hello World Hello World hello word

----
oc new-app nationalparks -p APPLICATION_HOSTNAME=nationalparks-roadshow.127.0.0.1.xip.io -p MAVEN_MIRROR_URL=http://nexus.ci:8081/content/groups/public
Expand All @@ -41,3 +43,10 @@ oc new-app nationalparks -p APPLICATION_HOSTNAME=nationalparks-roadshow.127.0.0.
National Parks data comes from link:https://protectedplanet.net[ProtectedPlanet], listing worldwide National Parks categories, filtered as units shown link:https://en.wikipedia.org/wiki/List_of_the_United_States_National_Park_System_official_units[here]

We used this link:https://www.protectedplanet.net/en/search-areas?filters%5Bis_type%5D%5B%5D=terrestrial&filters%5Bdesignation%5D%5B%5D=Nacional+Park&filters%5Bdesignation%5D%5B%5D=National+Forest+Park&filters%5Bdesignation%5D%5B%5D=National+Historic+Park&filters%5Bdesignation%5D%5B%5D=National+Battlefield&filters%5Bdesignation%5D%5B%5D=National+Historic+Site&filters%5Bdesignation%5D%5B%5D=National+Historical+Park&filters%5Bdesignation%5D%5B%5D=National+Lakeshore&filters%5Bdesignation%5D%5B%5D=National+Military+Park&filters%5Bdesignation%5D%5B%5D=National+Monument&filters%5Bdesignation%5D%5B%5D=National+Park&filters%5Bdesignation%5D%5B%5D=National+Park+%28Category+Ii%29&filters%5Bdesignation%5D%5B%5D=National+Park+%28Commonwealth%29&filters%5Bdesignation%5D%5B%5D=National+Park+%28Fbih+Law%29&filters%5Bdesignation%5D%5B%5D=National+Park+%28PN%29&filters%5Bdesignation%5D%5B%5D=National+Park+%28Rs+Law%29&filters%5Bdesignation%5D%5B%5D=National+Park+%28Scientific%29&filters%5Bdesignation%5D%5B%5D=National+Park+%28Svalbard%29&filters%5Bdesignation%5D%5B%5D=National+Park+%28project%29&filters%5Bdesignation%5D%5B%5D=National+Park+-+Buffer+Zone&filters%5Bdesignation%5D%5B%5D=National+Park+-+Buffer+Zone%2FArea+Of+Adhesion&filters%5Bdesignation%5D%5B%5D=National+Park+-+Core+Area&filters%5Bdesignation%5D%5B%5D=National+Park+-+Integrale+Reserve&filters%5Bdesignation%5D%5B%5D=National+Park+-+Peripheral+Zone&filters%5Bdesignation%5D%5B%5D=National+Park+Aboriginal&filters%5Bdesignation%5D%5B%5D=National+Park+and+ASEAN+Heritage+Park&filters%5Bdesignation%5D%5B%5D=National+Park+and+Ecological+Reserve&filters%5Bdesignation%5D%5B%5D=National+Park+and+Indigenous+Territory&filters%5Bdesignation%5D%5B%5D=National+Reserve&filters%5Bdesignation%5D%5B%5D=National+River&filters%5Bdesignation%5D%5B%5D=National+Seashore[query] listing 2830 National Parks at the moment.

test testing SITA RAM HANUMAN
SITA RAM HANUMAN
SITA RAM HANUMAN
Sita Ram Sita Ram
Hello Test
Hello World