Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
16 changes: 16 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Remove the line below if you want to inherit .editorconfig settings from higher directories
root = true

# C# files
[*.cs]

#### Core EditorConfig Options ####

# Indentation and spacing
indent_size = 4
indent_style = space
tab_width = 4

# New line preferences
end_of_line = lf
insert_final_newline = false
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Build transitory-documents-api
description: Builds the transitory-documents-api codebase

inputs:
working_directory:
description: The working directory where the code will be built.
required: true
dotnet_version:
description: The .NET version that will be used.
required: true

runs:
using: composite

steps:
- name: Setup .NET Core
uses: actions/setup-dotnet@67a3573c9a986a3f9c594539f4ab511d57bb3ce9 # v4
with:
dotnet-version: ${{ inputs.dotnet_version }}

- run: dotnet format --verify-no-changes --severity info
shell: bash
working-directory: ${{ inputs.working_directory }}/transitory-documents-api
continue-on-error: true

- run: dotnet restore
shell: bash
working-directory: ${{ inputs.working_directory }}

- run: dotnet build --configuration Release --no-restore
shell: bash
working-directory: ${{ inputs.working_directory }}/transitory-documents-api

- run: dotnet test --no-restore --verbosity normal
shell: bash
working-directory: ${{ inputs.working_directory }}/tests
35 changes: 35 additions & 0 deletions .github/workflows/build-and-test-transitory-documents-api.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Build and Test transitory documents api

permissions:
contents: read

on:
pull_request:
branches:
- master
paths:
- 'transitory-documents-api/**'

workflow_dispatch:

env:
WORKING_DIRECTORY: .

jobs:
build-and-test:
runs-on: ubuntu-latest

strategy:
matrix:
dotnet-major-version: [9]
dotnet-minor-version: [0]

steps:
- name: Checkout repository
uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5

- name: Building transitory documents codebase
uses: ./.github/workflows/actions/build-transitory-documents-api
with:
working_directory: ${{ env.WORKING_DIRECTORY }}
dotnet_version: ${{ matrix.dotnet-major-version }}.${{ matrix.dotnet-minor-version }}
124 changes: 124 additions & 0 deletions .github/workflows/publish-transitory-documents-api.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
name: Deploy transitory-documents-api

on:
push:
branches:
- master
paths:
- 'transitory-documents-api/**'

workflow_dispatch:
inputs:
gitops-branch:
description: GitOps repository branch to update
required: false
default: main
gitops-environment:
description: GitOps environment (dev, test, prod)
required: false
default: dev

permissions:
contents: read
packages: write

env:
WORKING_DIRECTORY: .
IMAGE_NAME: jasper-transitory-documents-api
GITHUB_IMAGE_REPO: ghcr.io/${{ github.repository_owner }}/jasper
GITOPS_REPOSITORY: bcgov-c/tenant-gitops-e4161f
GITOPS_BRANCH: ${{ github.event.inputs.gitops-branch || 'master' }}
GITOPS_ENVIRONMENT: ${{ github.event.inputs.gitops-environment || 'dev' }}
GITOPS_FILE_PATH: deploy/transitory-documents-api/${{ github.event.inputs.gitops-environment || 'dev' }}_values.yaml

jobs:
build:
name: Build, Create and Push Image
runs-on: ubuntu-latest
outputs:
short_sha: ${{ steps.short_sha.outputs.SHORT_SHA }}

strategy:
matrix:
dotnet-major-version: [9]
dotnet-minor-version: [0]

steps:
- name: Checkout repository
uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5

- name: Build API codebase
uses: ./.github/workflows/actions/build-transitory-documents-api
with:
working_directory: ${{ env.WORKING_DIRECTORY }}
dotnet_version: ${{ matrix.dotnet-major-version }}.${{ matrix.dotnet-minor-version }}

- name: Log in to the GHCR
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Get short SHA
id: short_sha
run: |
echo "SHORT_SHA=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT

- name: Setup Image Metadata
id: meta
uses: docker/metadata-action@c299e40c65443455700f0fdfc63efafe5b349051 # v5
with:
images: |
${{ env.GITHUB_IMAGE_REPO }}/${{ env.IMAGE_NAME }}
tags: |
type=raw,value=${{ steps.short_sha.outputs.SHORT_SHA }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3

- name: Build and Push Image to ghcr.io
id: build_image
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6
with:
push: true
context: .
file: ./docker/transitory-documents-api/Dockerfile.release
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
load: true
build-args: |
dotnet_version=${{ matrix.dotnet-major-version }}.${{ matrix.dotnet-minor-version }}

- name: Checkout tenant gitops repository
uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5
with:
repository: ${{ env.GITOPS_REPOSITORY }}
ssh-key: ${{ secrets.TENANT_GITOPS_E4161F_DEPLOY_KEY }}
ref: ${{ env.GITOPS_BRANCH }}
path: tenant-gitops-e4161f

- name: Update transitory-documents-api dev image reference
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

update the image name and tag directly in the gitops repo using a file and json key path to target the repository and image tag.

uses: fjogeleit/yaml-update-action@451fb54614e46f952fc18ffd99e8c93b7b13f85e # v0.15.0
with:
workDir: tenant-gitops-e4161f
valueFile: ${{ env.GITOPS_FILE_PATH }}
changes: |
{
"$['transitory-documents-api'].image.repository": "${{ env.GITHUB_IMAGE_REPO }}/${{ env.IMAGE_NAME }}",
"$['transitory-documents-api'].image.tag": "${{ steps.short_sha.outputs.SHORT_SHA }}"
}
commitChange: false

- name: Load SSH deploy key
uses: webfactory/ssh-agent@dc588b651fe13675774614f8e6a936a468676387 # v0.9.0
with:
ssh-private-key: ${{ secrets.TENANT_GITOPS_E4161F_DEPLOY_KEY }}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

uses a deploy key for authorization.


- name: Commit and push gitops update
uses: EndBug/add-and-commit@a94899bca583c204427a224a7af87c02f9b325d5 # v9
with:
cwd: tenant-gitops-e4161f
add: ${{ env.GITOPS_FILE_PATH }}
message: Update transitory-documents-api dev image to ${{ steps.short_sha.outputs.SHORT_SHA }}
push: true
16 changes: 16 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,22 @@
"sourceFileMap": {
"/opt/app-root/src": "${workspaceRoot}/"
}
},
{
"name": ".NET Core Docker Attach (TP)",
"type": "coreclr",
"request": "attach",
"processId": "${command:pickRemoteProcess}",
"pipeTransport": {
"pipeProgram": "docker",
"pipeArgs": ["exec", "-i", "jasper-transitory-documents-api-1"],
"debuggerPath": "/vsdbg/vsdbg",
"pipeCwd": "${workspaceRoot}",
"quoteArgs": false
},
"sourceFileMap": {
"/opt/app-root/src": "${workspaceRoot}/"
}
}
]
}
33 changes: 31 additions & 2 deletions SCV.sln
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.9.34723.18
# Visual Studio Version 18
VisualStudioVersion = 18.1.11312.151 d18.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "api", "api\api.csproj", "{46FE5ADD-2BAF-47D0-BB0B-912F9ED4F743}"
EndProject
Expand All @@ -14,6 +14,19 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "pcss-client", "pcss-client\
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "dars-client", "dars-client\dars-client.csproj", "{764F912A-D0FA-4272-ADEF-1335B8BE8D9C}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "transitory-documents-api", "transitory-documents-api\transitory-documents-api.csproj", "{69C5DC46-ACCE-404C-B392-4AA0921E2543}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "transitory-documents-client", "transitory-documents-client\transitory-documents-client.csproj", "{2A5C851A-91D9-412F-8D70-A419FE8FD990}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "core", "core\core.csproj", "{EA5798DF-7387-488B-A79F-5008031A2F22}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "models", "models\models.csproj", "{A4E730B4-88A7-4F22-B4F4-D60820C4A686}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{4C3B75C2-DF8E-4603-A97B-7C7D6D3B0DD8}"
ProjectSection(SolutionItems) = preProject
.editorconfig = .editorconfig
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -44,6 +57,22 @@ Global
{764F912A-D0FA-4272-ADEF-1335B8BE8D9C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{764F912A-D0FA-4272-ADEF-1335B8BE8D9C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{764F912A-D0FA-4272-ADEF-1335B8BE8D9C}.Release|Any CPU.Build.0 = Release|Any CPU
{69C5DC46-ACCE-404C-B392-4AA0921E2543}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{69C5DC46-ACCE-404C-B392-4AA0921E2543}.Debug|Any CPU.Build.0 = Debug|Any CPU
{69C5DC46-ACCE-404C-B392-4AA0921E2543}.Release|Any CPU.ActiveCfg = Release|Any CPU
{69C5DC46-ACCE-404C-B392-4AA0921E2543}.Release|Any CPU.Build.0 = Release|Any CPU
{2A5C851A-91D9-412F-8D70-A419FE8FD990}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2A5C851A-91D9-412F-8D70-A419FE8FD990}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2A5C851A-91D9-412F-8D70-A419FE8FD990}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2A5C851A-91D9-412F-8D70-A419FE8FD990}.Release|Any CPU.Build.0 = Release|Any CPU
{EA5798DF-7387-488B-A79F-5008031A2F22}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{EA5798DF-7387-488B-A79F-5008031A2F22}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EA5798DF-7387-488B-A79F-5008031A2F22}.Release|Any CPU.ActiveCfg = Release|Any CPU
{EA5798DF-7387-488B-A79F-5008031A2F22}.Release|Any CPU.Build.0 = Release|Any CPU
{A4E730B4-88A7-4F22-B4F4-D60820C4A686}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A4E730B4-88A7-4F22-B4F4-D60820C4A686}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A4E730B4-88A7-4F22-B4F4-D60820C4A686}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A4E730B4-88A7-4F22-B4F4-D60820C4A686}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
8 changes: 4 additions & 4 deletions api/Controllers/AccessControlManagementControllerBase.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
using System.Linq;
using System.Threading.Tasks;
using FluentValidation;
using FluentValidation;
using Microsoft.AspNetCore.Mvc;
using MongoDB.Bson;
using Scv.Api.Models;
using Scv.Api.Services;
using Scv.Models;
using System.Linq;
using System.Threading.Tasks;

namespace Scv.Api.Controllers;

Expand Down
2 changes: 1 addition & 1 deletion api/Controllers/ApplicationController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Configuration;
using Scv.Api.Helpers;
using Scv.Api.Infrastructure.Authorization;
using Scv.Core.Helpers.Extensions;

namespace Scv.Api.Controllers;

Expand Down
12 changes: 6 additions & 6 deletions api/Controllers/AuthController.cs
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
using System;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Authentication.Cookies;
using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.AspNetCore.Authentication.OpenIdConnect;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Configuration;
using Scv.Api.Helpers;
using Scv.Api.Helpers.Extensions;
using Scv.Api.Infrastructure.Authorization;
using Scv.Api.Infrastructure.Encryption;
using Scv.Api.Models.auth;
using Scv.Core.Helpers;
using Scv.Core.Helpers.Extensions;
using Scv.Db.Models;
using Scv.Db.Models.Auth;
using Scv.Models.auth;
using System;
using System.Threading.Tasks;

namespace Scv.Api.Controllers
{
Expand Down
8 changes: 4 additions & 4 deletions api/Controllers/BindersController.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Routing;
using Scv.Api.Documents;
using Scv.Api.Infrastructure.Authorization;
using Scv.Api.Models;
using Scv.Api.Services;
using Scv.Models;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace Scv.Api.Controllers;

Expand Down
4 changes: 2 additions & 2 deletions api/Controllers/CasesController.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Scv.Api.Helpers.Extensions;
using Scv.Api.Infrastructure.Authorization;
using Scv.Api.Services;
using Scv.Core.Helpers.Extensions;
using System.Threading.Tasks;

namespace Scv.Api.Controllers;

Expand Down
8 changes: 4 additions & 4 deletions api/Controllers/CodesController.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Scv.Api.Infrastructure.Authorization;
using Scv.Api.Models.Lookup;
using Scv.Api.Services;
using Scv.Models.Lookup;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace Scv.Api.Controllers
{
Expand Down
Loading
Loading