-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #939 from HDRUK/revert-938-revert-936-preprod
2 revert "GAT-1887: Testing New Release from preprod to prod gateway-api""
- Loading branch information
Showing
10 changed files
with
285 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,138 @@ | ||
name: Build and Deploy to Cloud Run | ||
|
||
on: | ||
push: | ||
paths: | ||
- 'Chart.yaml' | ||
|
||
env: | ||
PROJECT_ID: '${{ secrets.PROJECT_ID }}' # TODO: update Google Cloud project id. | ||
GAR_LOCATION: '${{ secrets.GAR_LOCATION }}' # TODO: update Artifact Registry location | ||
|
||
jobs: | ||
build: | ||
# needs: analyze | ||
# Add 'id-token' with the intended permissions for workload identity federation | ||
permissions: | ||
contents: write | ||
id-token: write | ||
|
||
runs-on: ubuntu-latest | ||
environment: legacy-dev | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
ref: dev | ||
|
||
- name: Read VERSION file | ||
id: getversion | ||
run: echo "version=$(cat Chart.yaml)" >> $GITHUB_OUTPUT | ||
# Used for production | ||
# - uses: "marvinpinto/action-automatic-releases@latest" | ||
# with: | ||
# repo_token: "${{ secrets.GITHUB_TOKEN }}" | ||
# automatic_release_tag: ${{ steps.getversion.outputs.version }} | ||
# prerelease: false | ||
|
||
- name: Google Auth | ||
id: auth | ||
uses: 'google-github-actions/auth@v0' | ||
with: | ||
token_format: 'access_token' | ||
workload_identity_provider: '${{ secrets.WIF_PROVIDER }}' | ||
service_account: '${{ secrets.WIF_SERVICE_ACCOUNT }}' | ||
|
||
- name: Login to GAR | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ${{ env.GAR_LOCATION }}-docker.pkg.dev/${{ env.PROJECT_ID }}/${{ env.PROJECT_ID }} | ||
username: oauth2accesstoken | ||
password: ${{ steps.auth.outputs.access_token }} | ||
|
||
- name: Build and Push Container | ||
shell: bash | ||
env: | ||
GAR_LOCATION: ${{ secrets.GAR_LOCATION }} | ||
PROJECT_ID: ${{ secrets.PROJECT_ID }} | ||
GAR_NAME: ${{ secrets.GAR_NAME_API }} | ||
|
||
run: |- | ||
docker build -t '${{ env.GAR_LOCATION }}'-docker.pkg.dev/'${{ env.PROJECT_ID }}'/'${{ env.GAR_NAME }}'/${{ steps.getversion.outputs.version }}:${{ github.sha }} -t '${{ env.GAR_LOCATION }}'-docker.pkg.dev/'${{ env.PROJECT_ID }}'/'${{ env.GAR_NAME }}'/${{ steps.getversion.outputs.version }}:latest ./ | ||
docker push --all-tags '${{ env.GAR_LOCATION }}'-docker.pkg.dev/'${{ env.PROJECT_ID }}'/'${{ env.GAR_NAME }}'/${{ steps.getversion.outputs.version }} | ||
# END - Docker auth and build | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
# Deployment please don't modify anything here as the infrastructure is controlled by terraform any changes here please agree with chris and reuben | ||
deploy: | ||
needs: build | ||
permissions: | ||
contents: write | ||
id-token: write | ||
|
||
runs-on: ubuntu-latest | ||
environment: legacy-dev | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
ref: dev | ||
|
||
- name: Google Auth | ||
id: auth | ||
uses: 'google-github-actions/auth@v0' | ||
with: | ||
token_format: 'access_token' | ||
workload_identity_provider: '${{ secrets.WIF_PROVIDER }}' | ||
service_account: '${{ secrets.WIF_SERVICE_ACCOUNT }}' | ||
|
||
- name: Read VERSION file | ||
id: getversion | ||
run: echo "version=$(cat Chart.yaml)" >> $GITHUB_OUTPUT | ||
|
||
- name: Deploy to Cloud Run | ||
uses: actions-hub/gcloud@master | ||
id: deploy | ||
env: | ||
PROJECT_ID: ${{ secrets.PROJECT_ID }} | ||
GAR_LOCATION: ${{ secrets.GAR_LOCATION }} | ||
GAR_NAME: ${{ secrets.GAR_NAME_API }} | ||
SERVICE_NAME: '${{ secrets.SERVICE_NAME_API }}' | ||
SERVICE_REGION: '${{ secrets.SERVICE_REGION_API }}' | ||
|
||
with: | ||
args: run services update '${{ env.SERVICE_NAME }}' --image='${{ env.GAR_LOCATION }}'-docker.pkg.dev/'${{ env.PROJECT_ID }}'/'${{ env.GAR_NAME }}'/${{ steps.getversion.outputs.version }}:${{ github.sha }} --region='${{ env.SERVICE_REGION }}' --project='${{ env.PROJECT_ID }}' | ||
# If required, use the Cloud Run url output in later steps |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
name: Deploy to Cloud Run | ||
|
||
on: | ||
pull_request: | ||
types: | ||
- closed | ||
branches: | ||
- 'preprod' | ||
|
||
env: | ||
PROJECT_ID: '${{ secrets.PROJECT_ID }}' # TODO: update Google Cloud project id. | ||
GAR_LOCATION: '${{ secrets.GAR_LOCATION }}' # TODO: update Artifact Registry location | ||
|
||
jobs: # Deployment please don't modify anything here as the infrastructure is controlled by terraform any changes here please agree with chris and reuben | ||
deploy: | ||
if: github.event.pull_request.merged == true | ||
permissions: | ||
contents: write | ||
id-token: write | ||
|
||
runs-on: ubuntu-latest | ||
environment: legacy-preprod | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
ref: preprod | ||
|
||
- name: Google Auth | ||
id: auth | ||
uses: 'google-github-actions/auth@v0' | ||
with: | ||
token_format: 'access_token' | ||
workload_identity_provider: '${{ secrets.WIF_PROVIDER }}' | ||
service_account: '${{ secrets.WIF_SERVICE_ACCOUNT }}' | ||
|
||
- name: Read VERSION file | ||
id: getversion | ||
run: echo "version=$(cat Chart.yaml)" >> $GITHUB_OUTPUT | ||
|
||
- name: Deploy to Cloud Run | ||
uses: actions-hub/gcloud@master | ||
id: deploy | ||
env: | ||
PROJECT_ID: ${{ secrets.PROJECT_ID }} | ||
DEV_PROJECT_ID: ${{ secrets.DEV_PROJECT_ID }} | ||
GAR_LOCATION: ${{ secrets.GAR_LOCATION }} | ||
GAR_NAME: ${{ secrets.GAR_NAME_API }} | ||
SERVICE_NAME: '${{ secrets.SERVICE_NAME_API }}' | ||
SERVICE_REGION: '${{ secrets.SERVICE_REGION_API }}' | ||
|
||
with: | ||
# args: run services update '${{ env.SERVICE_NAME }}' --image='${{ env.GAR_LOCATION }}'-docker.pkg.dev/'${{ env.DEV_PROJECT_ID }}'/'${{ env.GAR_NAME }}'/${{ steps.getversion.outputs.version }}:${{ github.sha }} --region='${{ env.SERVICE_REGION }}' --project='${{ env.PROJECT_ID }}' | ||
args: run services update '${{ env.SERVICE_NAME }}' --image='${{ env.GAR_LOCATION }}'-docker.pkg.dev/'${{ env.DEV_PROJECT_ID }}'/'${{ env.GAR_NAME }}'/${{ steps.getversion.outputs.version }}:latest --region='${{ env.SERVICE_REGION }}' --project='${{ env.PROJECT_ID }}' | ||
# If required, use the Cloud Run url output in later steps |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
name: Deploy to Cloud Run | ||
|
||
on: | ||
pull_request: | ||
types: | ||
- closed | ||
branches: | ||
- 'release' | ||
|
||
|
||
env: | ||
PROJECT_ID: '${{ secrets.PROJECT_ID }}' # TODO: update Google Cloud project id. | ||
GAR_LOCATION: '${{ secrets.GAR_LOCATION }}' # TODO: update Artifact Registry location | ||
|
||
jobs: # Deployment please don't modify anything here as the infrastructure is controlled by terraform any changes here please agree with chris and reuben. | ||
# catchsha: | ||
# uses: HDRUK/gateway-api/.github/workflows/dev_deployment.yaml@dev | ||
deploy: | ||
# if: github.event.pull_request.merged == true | ||
permissions: | ||
contents: write | ||
id-token: write | ||
|
||
runs-on: ubuntu-latest | ||
environment: legacy-uat | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
ref: release | ||
|
||
- name: Google Auth | ||
id: auth | ||
uses: 'google-github-actions/auth@v0' | ||
with: | ||
token_format: 'access_token' | ||
workload_identity_provider: '${{ secrets.WIF_PROVIDER }}' | ||
service_account: '${{ secrets.WIF_SERVICE_ACCOUNT }}' | ||
|
||
- name: Read VERSION file | ||
id: getversion | ||
# run: echo "::set-output name=version::$(cat Chart.yaml)" | ||
run: echo "version=$(cat Chart.yaml)" >> $GITHUB_OUTPUT | ||
|
||
# - name: Get SHA | ||
# id: getsha | ||
# run: echo ${{ needs.catchsha.outputs.GITHUB_SHA }} | ||
|
||
- name: Deploy to Cloud Run | ||
uses: actions-hub/gcloud@master | ||
id: deploy | ||
env: | ||
PROJECT_ID: ${{ secrets.PROJECT_ID }} | ||
DEV_PROJECT_ID: ${{ secrets.DEV_PROJECT_ID }} | ||
GAR_LOCATION: ${{ secrets.GAR_LOCATION }} | ||
GAR_NAME: ${{ secrets.GAR_NAME_API }} | ||
SERVICE_NAME: '${{ secrets.SERVICE_NAME_API }}' | ||
SERVICE_REGION: '${{ secrets.SERVICE_REGION_API }}' | ||
|
||
with: | ||
# args: run services update '${{ env.SERVICE_NAME }}' --image='${{ env.GAR_LOCATION }}'-docker.pkg.dev/'${{ env.DEV_PROJECT_ID }}'/'${{ env.GAR_NAME }}'/${{ steps.getversion.outputs.version }}:{{ steps.catchsha.outputs.GITHUB_SHA}} --region='${{ env.SERVICE_REGION }}' --project='${{ env.PROJECT_ID }}' | ||
# Functionality not supported by Github Actions one to ccheck back agin in the future | ||
args: run services update '${{ env.SERVICE_NAME }}' --image='${{ env.GAR_LOCATION }}'-docker.pkg.dev/'${{ env.DEV_PROJECT_ID }}'/'${{ env.GAR_NAME }}'/${{ steps.getversion.outputs.version }}:latest --region='${{ env.SERVICE_REGION }}' --project='${{ env.PROJECT_ID }}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
v0.0.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import express from 'express'; | ||
import passport from 'passport'; | ||
|
||
import { utils } from '../auth'; | ||
import { ROLES } from '../user/user.roles'; | ||
|
||
import datasetonboardingUtil from '../../utils/datasetonboarding.util'; | ||
|
||
const router = express.Router({ mergeParams: true }); | ||
|
||
router.post('/scoring', passport.authenticate('jwt'), utils.checkIsInRole(ROLES.Admin), async (req, res) => { | ||
const { dataset } = req.body; | ||
|
||
if (!dataset) { | ||
res.json({ success: false, error: 'Dataset object must be supplied and contain all required data', status: 400 }); | ||
} | ||
|
||
const verdict = await datasetonboardingUtil.buildMetadataQuality(dataset, dataset.datasetv2, dataset.pid); | ||
res.json({ success: true, data: verdict, status: 200 }); | ||
}); | ||
|
||
module.exports = router; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters