From 0cfc099d244233216b0572380a500bc7f6f6f6e7 Mon Sep 17 00:00:00 2001 From: Annibal Silva <105941480+annibalsilva@users.noreply.github.com> Date: Fri, 10 Feb 2023 15:40:07 -0300 Subject: [PATCH] chore: update things to match the repository's new name (#76) Fix: FSADT2-469 --- .github/openshift/deploy.backend.yml | 14 ++++++------ .github/openshift/networkPolicies.yml | 4 ++-- .github/workflows/merge-main.yml | 22 +++++++++---------- .github/workflows/pr-close.yml | 2 +- .github/workflows/pr-open.yml | 10 ++++----- .github/workflows/release.yml | 2 +- Dockerfile | 2 +- README.md | 10 ++++----- docker-compose.yml | 4 ++-- dockerfile-entrypoint.sh | 2 +- pom.xml | 8 +++---- .../endpoint/CheckEndpoint.java | 8 +++---- src/main/resources/application.properties | 2 +- src/test/resources/application.properties | 2 +- test/postman/README.md | 4 ++-- ...son => oracle-api.postman_collection.json} | 6 ++--- ...on => oracle-api.postman_environment.json} | 4 ++-- 17 files changed, 53 insertions(+), 53 deletions(-) rename test/postman/{starting-api.postman_collection.json => oracle-api.postman_collection.json} (97%) rename test/postman/{starting-api.postman_environment.json => oracle-api.postman_environment.json} (96%) diff --git a/.github/openshift/deploy.backend.yml b/.github/openshift/deploy.backend.yml index a4858074e..c51f78114 100644 --- a/.github/openshift/deploy.backend.yml +++ b/.github/openshift/deploy.backend.yml @@ -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 labels: app: ${NAME}-${ZONE} @@ -12,7 +12,7 @@ labels: parameters: - name: NAME description: Module name - value: nrbestapi + value: nr-spar-oracle-api - name: COMPONENT description: Component name value: service-api @@ -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 @@ -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 diff --git a/.github/openshift/networkPolicies.yml b/.github/openshift/networkPolicies.yml index 480a5271d..599103a14 100644 --- a/.github/openshift/networkPolicies.yml +++ b/.github/openshift/networkPolicies.yml @@ -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 diff --git a/.github/workflows/merge-main.yml b/.github/workflows/merge-main.yml index a2324064d..56efd6e5a 100644 --- a/.github/workflows/merge-main.yml +++ b/.github/workflows/merge-main.yml @@ -10,7 +10,7 @@ on: env: REGISTRY: ghcr.io - NAME: nrbestapi + NAME: nr-spar-oracle-api concurrency: group: ${{ github.workflow }} @@ -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 @@ -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 @@ -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 }} \ @@ -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 }}" \ @@ -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' @@ -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 @@ -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 }} \ diff --git a/.github/workflows/pr-close.yml b/.github/workflows/pr-close.yml index 66c464979..e36a31c77 100644 --- a/.github/workflows/pr-close.yml +++ b/.github/workflows/pr-close.yml @@ -9,7 +9,7 @@ on: env: REGISTRY: ghcr.io - NAME: nrbestapi + NAME: nr-spar-oracle-api concurrency: group: ${{ github.workflow }}-${{ github.ref }} diff --git a/.github/workflows/pr-open.yml b/.github/workflows/pr-open.yml index 568406523..e6797ac7f 100644 --- a/.github/workflows/pr-open.yml +++ b/.github/workflows/pr-open.yml @@ -12,7 +12,7 @@ on: env: REGISTRY: ghcr.io - NAME: nrbestapi + NAME: nr-spar-oracle-api KEYCLOAK_REALM_URL: ${{ secrets.KEYCLOAK_REALM_URL }} concurrency: @@ -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: @@ -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 @@ -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 }} \ @@ -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 }}" \ diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 62a9a1408..fac653edc 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -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: diff --git a/Dockerfile b/Dockerfile index 98a9e61f2..f6b57cb15 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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 && \ diff --git a/README.md b/README.md index 6d33a61cc..b98e2d74b 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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= DATABASE_PORT= SERVICE_NAME= @@ -90,14 +90,14 @@ KEYCLOAK_REALM_URL= 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: diff --git a/docker-compose.yml b/docker-compose.yml index 84b4413b1..7f81a4f0d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -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} @@ -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 diff --git a/dockerfile-entrypoint.sh b/dockerfile-entrypoint.sh index 9763839b2..cbb14edcd 100755 --- a/dockerfile-entrypoint.sh +++ b/dockerfile-entrypoint.sh @@ -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 diff --git a/pom.xml b/pom.xml index eb819d322..56a4976ee 100644 --- a/pom.xml +++ b/pom.xml @@ -9,10 +9,10 @@ ca.bc.gov - backend-start-api + nr-spar-oracle-api 0.9.8 - backend-start-api - Starting backend API project + nr-spar-oracle-api + API to fetch data from THE to SPAR @@ -376,7 +376,7 @@ - backend-start-api + nr-spar-oracle-api diff --git a/src/main/java/ca/bc/gov/backendstartapi/endpoint/CheckEndpoint.java b/src/main/java/ca/bc/gov/backendstartapi/endpoint/CheckEndpoint.java index 6c46d0484..24553b8c7 100644 --- a/src/main/java/ca/bc/gov/backendstartapi/endpoint/CheckEndpoint.java +++ b/src/main/java/ca/bc/gov/backendstartapi/endpoint/CheckEndpoint.java @@ -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. @@ -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); } } diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index d46824f27..a72f17c9c 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -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*'}} diff --git a/src/test/resources/application.properties b/src/test/resources/application.properties index 95db83b3c..b932b4385 100644 --- a/src/test/resources/application.properties +++ b/src/test/resources/application.properties @@ -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*'}} diff --git a/test/postman/README.md b/test/postman/README.md index 2bbc0b58a..cd4e9b3fc 100644 --- a/test/postman/README.md +++ b/test/postman/README.md @@ -1,6 +1,6 @@ # 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 @@ -8,4 +8,4 @@ Import the collection and environment to your Postman and use the Collection Run ## 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**. \ No newline at end of file +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**. diff --git a/test/postman/starting-api.postman_collection.json b/test/postman/oracle-api.postman_collection.json similarity index 97% rename from test/postman/starting-api.postman_collection.json rename to test/postman/oracle-api.postman_collection.json index ffa638eae..935a7da91 100644 --- a/test/postman/starting-api.postman_collection.json +++ b/test/postman/oracle-api.postman_collection.json @@ -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" }, @@ -697,4 +697,4 @@ } } ] -} \ No newline at end of file +} diff --git a/test/postman/starting-api.postman_environment.json b/test/postman/oracle-api.postman_environment.json similarity index 96% rename from test/postman/starting-api.postman_environment.json rename to test/postman/oracle-api.postman_environment.json index 929bd46ee..c3f6e12cb 100644 --- a/test/postman/starting-api.postman_environment.json +++ b/test/postman/oracle-api.postman_environment.json @@ -1,6 +1,6 @@ { "id": "b5b2a1ec-47ba-4df9-89eb-cef9a91633c4", - "name": "starting-api env", + "name": "oracle-api env", "values": [ { "key": "apiAddr", @@ -41,4 +41,4 @@ "_postman_variable_scope": "environment", "_postman_exported_at": "2022-11-10T19:54:16.524Z", "_postman_exported_using": "Postman/9.31.23" -} \ No newline at end of file +}