Skip to content

Commit

Permalink
chore: update things to match the repository's new name (#76)
Browse files Browse the repository at this point in the history
Fix: FSADT2-469
  • Loading branch information
annibalsilva authored and DerekRoberts committed May 13, 2024
1 parent 20410cf commit 6ac1dfc
Show file tree
Hide file tree
Showing 17 changed files with 53 additions and 53 deletions.
14 changes: 7 additions & 7 deletions .github/openshift/deploy.backend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@ kind: Template
metadata:
name: ${NAME}
annotations:
description: "NR Backend Starting API"
tags: "nrbestapi"
description: "NR SPAR Oracle API"
tags: "nr-spar-oracle-api"
iconClass: icon-java
labels:
app: ${NAME}-${ZONE}
app.kubernetes.io/part-of: ${NAME}-${ZONE}
parameters:
- name: NAME
description: Module name
value: nrbestapi
value: nr-spar-oracle-api
- name: COMPONENT
description: Component name
value: service-api
Expand All @@ -33,8 +33,8 @@ parameters:
value: ghcr.io
- name: PROMOTE
description: Image (namespace/name:tag) to promote/import
value: bcgov/nr-backend-starting-api:prod-service-api
- name: NRBESTAPI_VERSION
value: bcgov/nr-spar-oracle-api:prod-service-api
- name: NR_SPAR_ORACLE_API_VERSION
description: Current service API release version
required: true
- name: ALLOWED_ORIGINS
Expand Down Expand Up @@ -108,8 +108,8 @@ objects:
imagePullPolicy: Always
name: ${NAME}
env:
- name: NRBESTAPI_VERSION
value: ${NRBESTAPI_VERSION}
- name: NR_SPAR_ORACLE_API_VERSION
value: ${NR_SPAR_ORACLE_API_VERSION}
- name: ALLOWED_ORIGINS
value: ${ALLOWED_ORIGINS}
- name: DATABASE_HOST
Expand Down
4 changes: 2 additions & 2 deletions .github/openshift/networkPolicies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ kind: Template
metadata:
name: ${NAME}
annotations:
description: "NR Backend Starting API"
tags: "nrbestapi"
description: "NR SPAR Oracle API"
tags: "nr-spar-oracle-api"
iconClass: icon-java
objects:
- apiVersion: networking.k8s.io/v1
Expand Down
22 changes: 11 additions & 11 deletions .github/workflows/merge-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:

env:
REGISTRY: ghcr.io
NAME: nrbestapi
NAME: nr-spar-oracle-api

concurrency:
group: ${{ github.workflow }}
Expand Down Expand Up @@ -210,7 +210,7 @@ jobs:
name: test
env:
ZONE: test
NRBESTAPI_VERSION: ${{ needs.release.outputs.version }}
NR_SPAR_ORACLE_API_VERSION: ${{ needs.release.outputs.version }}
steps:
- name: Import Secrets
id: secrets
Expand All @@ -224,8 +224,8 @@ jobs:
apps/data/test/spar/app-spar/db_proxy_read_only db_password | VAULT_DB_PASS;
- uses: actions/checkout@v3
- name: Print NRBESTAPI_VERSION env
run: echo NRBESTAPI_VERSION:test-${{ env.NRBESTAPI_VERSION }}
- name: Print NR_SPAR_ORACLE_API_VERSION env
run: echo NR_SPAR_ORACLE_API_VERSION:test-${{ env.NR_SPAR_ORACLE_API_VERSION }}
- name: Deploy
run: |
# Login to OpenShift and select project
Expand All @@ -235,7 +235,7 @@ jobs:
#oc process -f .github/openshift/deploy.database.yml -p ZONE=${{ env.ZONE }} | oc create -f - || true
# Process and apply deployment templates
oc process -f .github/openshift/deploy.backend.yml -p ZONE=${{ env.ZONE }} \
-p NRBESTAPI_VERSION=test-${{ env.NRBESTAPI_VERSION }} \
-p NR_SPAR_ORACLE_API_VERSION=test-${{ env.NR_SPAR_ORACLE_API_VERSION }} \
-p DATABASE_HOST=${{ secrets.DATABASE_HOST }} \
-p DATABASE_PORT=${{ secrets.DATABASE_PORT }} \
-p SERVICE_NAME=${{ secrets.SERVICE_NAME }} \
Expand Down Expand Up @@ -294,8 +294,8 @@ jobs:

- name: Run Postman Collection
run: |
newman run test/postman/starting-api.postman_collection.json -e test/postman/starting-api.postman_environment.json \
--env-var "releaseVer=test=${{ env.NRBESTAPI_VERSION }}" \
newman run test/postman/oracle-api.postman_collection.json -e test/postman/oracle-api.postman_environment.json \
--env-var "releaseVer=test=${{ env.NR_SPAR_ORACLE_API_VERSION }}" \
--env-var "authServer=${{ secrets.KEYCLOAK_SERVER_REALM }}" \
--env-var "authClient=${{ secrets.KC_SERVICE_ACCOUNT_NAME }}" \
--env-var "authClient=${{ secrets.KC_SERVICE_ACCOUNT_PASS }}" \
Expand Down Expand Up @@ -393,7 +393,7 @@ jobs:
env:
ZONE: prod
PREV: test
NRBESTAPI_VERSION: ${{ needs.release.outputs.version }}
NR_SPAR_ORACLE_API_VERSION: ${{ needs.release.outputs.version }}
steps:
- name: Remove any stale images
if: needs.image-service-api.outputs.build == 'true'
Expand All @@ -417,8 +417,8 @@ jobs:
apps/data/prod/spar/app-spar/db_proxy_read_only db_password | VAULT_DB_PASS;
- uses: actions/checkout@v3
- name: Print NRBESTAPI_VERSION env
run: echo NRBESTAPI_VERSION:prod-${{ env.NRBESTAPI_VERSION }}
- name: Print NR_SPAR_ORACLE_API_VERSION env
run: echo NR_SPAR_ORACLE_API_VERSION:prod-${{ env.NR_SPAR_ORACLE_API_VERSION }}
- name: Deploy
run: |
# Login to OpenShift and select project
Expand All @@ -433,7 +433,7 @@ jobs:
# Process and apply deployment templates
#oc process -f .github/openshift/deploy.database.yml -p ZONE=${{ env.ZONE }} | oc apply -f -
oc process -f .github/openshift/deploy.backend.yml -p ZONE=${{ env.ZONE }} \
-p NRBESTAPI_VERSION=prod-${{ env.NRBESTAPI_VERSION }} \
-p NR_SPAR_ORACLE_API_VERSION=prod-${{ env.NR_SPAR_ORACLE_API_VERSION }} \
-p DATABASE_HOST=${{ secrets.DATABASE_HOST }} \
-p DATABASE_PORT=${{ secrets.DATABASE_PORT }} \
-p SERVICE_NAME=${{ secrets.SERVICE_NAME }} \
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pr-close.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:

env:
REGISTRY: ghcr.io
NAME: nrbestapi
NAME: nr-spar-oracle-api

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/pr-open.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ on:

env:
REGISTRY: ghcr.io
NAME: nrbestapi
NAME: nr-spar-oracle-api
KEYCLOAK_REALM_URL: ${{ secrets.KEYCLOAK_REALM_URL }}

concurrency:
Expand Down Expand Up @@ -279,7 +279,7 @@ jobs:
env:
COMPONENT: service-api
ZONE: ${{ github.event.number }}
NRBESTAPI_VERSION: snapshot-${{ github.event.number }}
NR_SPAR_ORACLE_API_VERSION: snapshot-${{ github.event.number }}
runs-on: ubuntu-latest
if: github.event_name == 'pull_request' && github.event.pull_request.base.ref == 'main'
needs:
Expand Down Expand Up @@ -334,7 +334,7 @@ jobs:
timeout-minutes: 15
env:
ZONE: ${{ github.event.number }}
NRBESTAPI_VERSION: snapshot-${{ github.event.number }}
NR_SPAR_ORACLE_API_VERSION: snapshot-${{ github.event.number }}
steps:
- uses: actions/checkout@v3
- name: Deploy
Expand All @@ -353,7 +353,7 @@ jobs:
# Process and apply template
oc process -f .github/openshift/deploy.backend.yml -p ZONE=${{ env.ZONE }} \
-p NRBESTAPI_VERSION=${{ env.NRBESTAPI_VERSION }} \
-p NR_SPAR_ORACLE_API_VERSION=${{ env.NR_SPAR_ORACLE_API_VERSION }} \
-p ALLOWED_ORIGINS=${{ secrets.ALLOWED_ORIGINS }} \
-p DATABASE_HOST=${{ secrets.DATABASE_HOST }} \
-p DATABASE_PORT=${{ secrets.DATABASE_PORT }} \
Expand Down Expand Up @@ -400,7 +400,7 @@ jobs:

- name: Run Postman Collection
run: |
newman run test/postman/starting-api.postman_collection.json -e test/postman/starting-api.postman_environment.json \
newman run test/postman/oracle-api.postman_collection.json -e test/postman/oracle-api.postman_environment.json \
--env-var "apiAddr=${{ env.NAME }}-${{ github.event.number }}-service-api.apps.silver.devops.gov.bc.ca" \
--env-var "releaseVer=snapshot-${{ github.event.number }}" \
--env-var "authServer=${{ secrets.KEYCLOAK_SERVER_REALM }}" \
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
uses: actions/upload-artifact@master
with:
name: service
path: target/backend-start-api.jar
path: target/nr-spar-oracle-api.jar
retention-days: 1

push_to_registry:
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ ENV LC_ALL en_CA.UTF-8
COPY InstallCert.java .
COPY HealthCheck.java .

COPY ./target/backend-start-api.jar /usr/share/service/artifacts/backend-start-api.jar
COPY ./target/nr-spar-oracle-api.jar /usr/share/service/artifacts/nr-spar-oracle-api.jar
COPY dockerfile-entrypoint.sh /usr/share/service/dockerfile-entrypoint.sh
RUN chmod -R g+w . && \
chmod g+x dockerfile-entrypoint.sh && \
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
[![Lifecycle:Experimental](https://img.shields.io/badge/Lifecycle-Experimental-339999)](https://github.com/bcgov/nr-backend-starting-api)
[![Lifecycle:Experimental](https://img.shields.io/badge/Lifecycle-Experimental-339999)](https://github.com/bcgov/nr-spar-oracle-api)
![Coverage](.github/badges/jacoco.svg)
![Branches](.github/badges/branches.svg)
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=bcgov_nr-backend-starting-api&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=bcgov_nr-backend-starting-api)

# Natural Resources Back-End Starting API
# Natural Resources SPAR Oracle API

This repository holds a set of policies, standards, guides, and pipelines to
get started with a back-end API. Before writing your first line of code, please
Expand Down Expand Up @@ -79,7 +79,7 @@ using Docker.

Note that you'll need these environment variables:
```
NRBESTAPI_VERSION=local
NR_SPAR_ORACLE_API_VERSION=local
DATABASE_HOST=<host>
DATABASE_PORT=<port>
SERVICE_NAME=<service-name>
Expand All @@ -90,14 +90,14 @@ KEYCLOAK_REALM_URL=<realm-server-address>

Build the service:
```
docker build -t bcgov/nrbestapi-test-service-api:latest .
docker build -t bcgov/nr-spar-oracle-api:latest .
```

Then run with:
```
docker run -p 8090:8090 \
-e KEYCLOAK_REALM_URL=https://dev.loginproxy.gov.bc.ca/auth/realms/standard \
-t bcgov/nrbestapi-test-service-api:latest
-t bcgov/nr-spar-oracle-api-service:latest
```

However, if you have docker-compose you can do:
Expand Down
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ services:
container_name: backend
dns: ${DNS_ADDRESS}
environment:
NRBESTAPI_VERSION: ${NRBESTAPI_VERSION}
NR_SPAR_ORACLE_API_VERSION: ${NR_SPAR_ORACLE_API_VERSION}
DATABASE_HOST: ${DATABASE_HOST}
DATABASE_PORT: ${DATABASE_PORT}
SERVICE_NAME: ${SERVICE_NAME}
Expand All @@ -20,7 +20,7 @@ services:
timeout: 10s
retries: 3
start_period: 40s
image: bcgov/nrbestapi-test-service-api:latest
image: bcgov/nr-spar-oracle-api:latest
network_mode: "host"
volumes:
- ./target:/usr/share/service/artifacts
2 changes: 1 addition & 1 deletion dockerfile-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ java \
-Djava.security.egd=file:/dev/./urandom \
${JAVA_OPTS} \
-jar \
/usr/share/service/artifacts/backend-start-api.jar
/usr/share/service/artifacts/nr-spar-oracle-api.jar
8 changes: 4 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>ca.bc.gov</groupId>
<artifactId>backend-start-api</artifactId>
<artifactId>nr-spar-oracle-api</artifactId>
<version>0.9.8</version>
<name>backend-start-api</name>
<description>Starting backend API project</description>
<name>nr-spar-oracle-api</name>
<description>API to fetch data from THE to SPAR</description>

<licenses>
<license>
Expand Down Expand Up @@ -376,7 +376,7 @@
</executions>
</plugin>
</plugins>
<finalName>backend-start-api</finalName>
<finalName>nr-spar-oracle-api</finalName>
</build>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
@Hidden
public class CheckEndpoint {

@Value("${nrbestapi.version}")
private String nrbestapiVersion;
@Value("${nr-spar-oracle-api.version}")
private String nrSparOracleApiVersion;

/**
* Check if the service is up and running.
Expand All @@ -24,7 +24,7 @@ public class CheckEndpoint {
*/
@GetMapping(value = "/check", produces = MediaType.APPLICATION_JSON_VALUE)
public CheckVo check() {
log.info("nrbestapiVersion: {}", nrbestapiVersion);
return new CheckVo("OK", nrbestapiVersion);
log.info("nrSparOracleApiVersion: {}", nrSparOracleApiVersion);
return new CheckVo("OK", nrSparOracleApiVersion);
}
}
2 changes: 1 addition & 1 deletion src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@ spring.jpa.database-platform=org.hibernate.dialect.OracleDialect
management.endpoint.health.show-details = always

# Others
nrbestapi.version = ${NRBESTAPI_VERSION:#{'dev'}}
nr-spar-oracle-api.version = ${NR_SPAR_ORACLE_API_VERSION:dev}
server.allowed.cors.origins = ${ALLOWED_ORIGINS:#{'http://localhost:300*'}}
2 changes: 1 addition & 1 deletion src/test/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ spring.jpa.hibernate.ddl-auto=create-drop
management.endpoint.health.show-details = always

# Others
nrbestapi.version = ${NRBESTAPI_VERSION:#{'dev'}}
nr-spar-oracle-api.version = ${NR_SPAR_ORACLE_API_VERSION:dev}
server.allowed.cors.origins = ${ALLOWED_ORIGINS:#{'http://localhost:300*'}}
4 changes: 2 additions & 2 deletions test/postman/README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Postman Collection

On this folder there are two files that contains the API tests, all those tests are in the Postman format along with the environment needed to run. The first file `starting-api.postman_collection.json` it's the collection itself with all the requests and tests, and the second file `starting-api.postman_environment.json` contains all the variables.
On this folder there are two files that contains the API tests, all those tests are in the Postman format along with the environment needed to run. The first file `oracle-api.postman_collection.json` it's the collection itself with all the requests and tests, and the second file `oracle-api.postman_environment.json` contains all the variables.

## How to Run

Import the collection and environment to your Postman and use the Collection Runner to run. Make sure to fill in all the values on the environment variables, and if needed ask the dev team. By default, the tests run against the test environment.

## Secrets

All the authentication variables should be marked as the _secret_ type and only set then as _current_, **never fill the default value and also do not commit those values**.
All the authentication variables should be marked as the _secret_ type and only set then as _current_, **never fill the default value and also do not commit those values**.
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"info": {
"_postman_id": "4cd8a8d1-1dd6-47ba-8dc9-45f8e4621a07",
"name": "starting-api test collection",
"description": "## Description\nThis collection contains the API tests of the starting API.\n## Coverage\nThe aim is to have a coverage of 100%, every request on the API should have a mathcing test in this collection.\n## What to test\n- Status code\n- Response body field validation\n- Response time (1s avg)",
"name": "NR SPAR Oracle API test collection",
"description": "## Description\nThis collection contains the tests of the Oracle API.\n## Coverage\nThe aim is to have a coverage of 100%, every request on the API should have a matching test in this collection.\n## What to test\n- Status code\n- Response body field validation\n- Response time (1s avg)",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
"_exporter_id": "23598385"
},
Expand Down Expand Up @@ -697,4 +697,4 @@
}
}
]
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"id": "b5b2a1ec-47ba-4df9-89eb-cef9a91633c4",
"name": "starting-api env",
"name": "oracle-api env",
"values": [
{
"key": "apiAddr",
Expand Down Expand Up @@ -41,4 +41,4 @@
"_postman_variable_scope": "environment",
"_postman_exported_at": "2022-11-10T19:54:16.524Z",
"_postman_exported_using": "Postman/9.31.23"
}
}

0 comments on commit 6ac1dfc

Please sign in to comment.