-
Notifications
You must be signed in to change notification settings - Fork 1
Jasper 342 (P-Drive) #733
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
base: master
Are you sure you want to change the base?
Jasper 342 (P-Drive) #733
Changes from all commits
16efdee
85177f4
d743b73
5df247d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| # 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 = true | ||
|
|
||
| # Analyzer severities | ||
| # IDE0005: Using directive is unnecessary | ||
| dotnet_diagnostic.IDE0005.severity = warning | ||
| # CA1873: Potentially expensive logging argument evaluation | ||
| dotnet_diagnostic.CA1873.severity = none |
| 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: false | ||
|
|
||
| - 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 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| name: Build and Test transitory-documents-api | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| on: | ||
| pull_request: | ||
| branches: | ||
| - master | ||
| paths: | ||
| - 'transitory-documents-api/**' | ||
| - 'transitory-documents-client/**' | ||
| - 'models/**' | ||
| - 'core/**' | ||
|
|
||
| workflow_dispatch: | ||
|
|
||
| env: | ||
| WORKING_DIRECTORY: . | ||
|
|
||
| jobs: | ||
| build-and-test: | ||
| runs-on: ubuntu-latest | ||
|
|
||
| strategy: | ||
| matrix: | ||
| dotnet-major-version: [10] | ||
| 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 }} | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,123 @@ | ||
| 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 || 'main' }} | ||
| 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: [10] | ||
| 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 }} | ||
| 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 | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 }} | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 ${{ env.GITOPS_ENVIRONMENT }} image to ${{ steps.short_sha.outputs.SHORT_SHA }} | ||
| push: true | ||
This file was deleted.
Uh oh!
There was an error while loading. Please reload this page.