-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 22bcffd
Showing
49 changed files
with
2,077 additions
and
0 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,23 @@ | ||
# [Choice] .NET version: 6.0-bullseye-slim, 6.0-jammy, 6.0-focal | ||
FROM mcr.microsoft.com/devcontainers/dotnet:0-6.0-jammy | ||
|
||
ENV DOCKER_BUILDKIT=1 | ||
ENV DOCKER_DEFAULT_PLATFORM=linux/amd64 | ||
|
||
# [Optional] Uncomment this section to install additional OS packages. | ||
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ | ||
&& apt-get -y install --no-install-recommends git curl exa | ||
|
||
# Install Docker to use in docker-in-docker | ||
RUN apt-get update && apt-get install -y curl \ | ||
&& rm -rf /var/lib/apt/lists/* \ | ||
&& curl -fsSL https://get.docker.com -o get-docker.sh && sh get-docker.sh | ||
# Add user "admin" to the Docker group | ||
#&& usermod -a -G docker admin | ||
ADD https://raw.githubusercontent.com/docker/docker-ce/master/components/cli/contrib/completion/bash/docker /etc/bash_completion.d/docker.sh | ||
|
||
USER vscode | ||
ARG GITHUB_ACTOR | ||
ARG GITHUB_TOKEN | ||
|
||
RUN dotnet nuget add source https://nuget.pkg.github.com/trifork/index.json -n trifork-github -u $GITHUB_ACTOR -p $GITHUB_TOKEN --store-password-in-clear-text |
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,67 @@ | ||
// For format details, see https://aka.ms/devcontainer.json. For config options, see the | ||
// README at: https://github.com/devcontainers/templates/tree/main/src/dotnet | ||
{ | ||
"name": ".NET DevContainer", | ||
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile | ||
"build": { | ||
"dockerfile": "./Dockerfile", | ||
"context": ".", | ||
"args": { | ||
"GITHUB_ACTOR": "${localEnv:GITHUB_ACTOR}", | ||
"GITHUB_TOKEN": "${localEnv:GITHUB_TOKEN}" | ||
} | ||
}, | ||
"containerEnv": { | ||
"GITHUB_ACTOR": "${localEnv:GITHUB_ACTOR}", | ||
"GITHUB_TOKEN": "${localEnv:GITHUB_TOKEN}" | ||
}, | ||
"runArgs": [ | ||
// Network where OpenSearch is running | ||
"--network=cheetah-infrastructure" | ||
], | ||
"initializeCommand": "docker network create cheetah-infrastructure || true", | ||
"customizations": { | ||
"vscode": { | ||
"extensions": [ | ||
// Recommended extensions - GitHub | ||
"GitHub.vscode-pull-request-github", | ||
"GitHub.copilot", | ||
// Recommended extensions - Collaboration | ||
"eamodio.gitlens", | ||
"EditorConfig.EditorConfig", | ||
"MS-vsliveshare.vsliveshare-pack", | ||
"streetsidesoftware.code-spell-checker", | ||
"redhat.vscode-yaml", | ||
// Recommended extensions - .NET | ||
"Fudge.auto-using", | ||
"jongrant.csharpsortusings", | ||
"kreativ-software.csharpextensions", | ||
// Recommended extensions - Markdown | ||
"bierner.github-markdown-preview", | ||
"DavidAnson.vscode-markdownlint", | ||
"docsmsft.docs-linting", | ||
"yzhang.markdown-all-in-one", | ||
// Required extensions | ||
"ms-dotnettools.csharp", | ||
"VisualStudioExptTeam.vscodeintellicode", | ||
"aliasadidev.nugetpackagemanagergui" | ||
] | ||
} | ||
}, | ||
"features": { | ||
"ghcr.io/devcontainers/features/docker-in-docker:2": {} | ||
}, | ||
// Use 'forwardPorts' to make a list of ports inside the container available locally. | ||
// "forwardPorts": [5000, 5001], | ||
// "portsAttributes": { | ||
// "5001": { | ||
// "protocol": "https" | ||
// } | ||
// } | ||
// Use 'postCreateCommand' to run commands after the container is created. | ||
// "postCreateCommand": "dotnet restore", | ||
// Configure tool-specific properties. | ||
// "customizations": {}, | ||
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. | ||
"remoteUser": "root" | ||
} |
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 @@ | ||
COMPOSE_FILE=src/docker-compose.yml |
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,65 @@ | ||
############################################################################### | ||
# Set default behavior to automatically normalize line endings. | ||
############################################################################### | ||
* text=auto | ||
*.cs text eol=crlf | ||
*.sh text eol=lf | ||
|
||
############################################################################### | ||
# Set default behavior for command prompt diff. | ||
# | ||
# This is need for earlier builds of msysgit that does not have it on by | ||
# default for csharp files. | ||
# Note: This is only used by command line | ||
############################################################################### | ||
#*.cs diff=csharp | ||
|
||
############################################################################### | ||
# Set the merge driver for project and solution files | ||
# | ||
# Merging from the command prompt will add diff markers to the files if there | ||
# are conflicts (Merging from VS is not affected by the settings below, in VS | ||
# the diff markers are never inserted). Diff markers may cause the following | ||
# file extensions to fail to load in VS. An alternative would be to treat | ||
# these files as binary and thus will always conflict and require user | ||
# intervention with every merge. To do so, just uncomment the entries below | ||
############################################################################### | ||
#*.sln merge=binary | ||
#*.csproj merge=binary | ||
#*.vbproj merge=binary | ||
#*.vcxproj merge=binary | ||
#*.vcproj merge=binary | ||
#*.dbproj merge=binary | ||
#*.fsproj merge=binary | ||
#*.lsproj merge=binary | ||
#*.wixproj merge=binary | ||
#*.modelproj merge=binary | ||
#*.sqlproj merge=binary | ||
#*.wwaproj merge=binary | ||
|
||
############################################################################### | ||
# behavior for image files | ||
# | ||
# image files are treated as binary by default. | ||
############################################################################### | ||
#*.jpg binary | ||
#*.png binary | ||
#*.gif binary | ||
|
||
############################################################################### | ||
# diff behavior for common document formats | ||
# | ||
# Convert binary document formats to text before diffing them. This feature | ||
# is only available from the command line. Turn it on by uncommenting the | ||
# entries below. | ||
############################################################################### | ||
#*.doc diff=astextplain | ||
#*.DOC diff=astextplain | ||
#*.docx diff=astextplain | ||
#*.DOCX diff=astextplain | ||
#*.dot diff=astextplain | ||
#*.DOT diff=astextplain | ||
#*.pdf diff=astextplain | ||
#*.PDF diff=astextplain | ||
#*.rtf diff=astextplain | ||
#*.RTF diff=astextplain |
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,107 @@ | ||
name: E2E | ||
|
||
on: | ||
workflow_call: | ||
workflow_dispatch: | ||
schedule: | ||
- cron: "0 3 * * *" | ||
push: | ||
branches: [ 'main', 'release/v**' ] | ||
pull_request: | ||
branches: [ 'main', 'release/v**' ] | ||
types: [ opened, synchronize, reopened, labeled ] | ||
|
||
concurrency: | ||
group: ${{ github.ref }}-${{ github.workflow }} | ||
cancel-in-progress: true | ||
|
||
env: | ||
CONTEXT: . | ||
|
||
jobs: | ||
should-run: # seperate step to support ci/cd status checks | ||
runs-on: ubuntu-latest | ||
outputs: | ||
tag-check: ${{ steps.tag-check.outputs.value }} | ||
event-name-check: ${{ steps.event-name-check.outputs.value }} | ||
|
||
steps: | ||
# the pull request contains the 'e2e-test' label | ||
- name: Tag check | ||
id: tag-check | ||
if: ${{ contains(github.event.pull_request.labels.*.name, 'e2e-test') && !contains(github.event.pull_request.labels.*.name, 'blocked') }} | ||
run: echo "value=true" >> "$GITHUB_OUTPUT" | ||
|
||
# not started from a pull-request | ||
- name: Check for specific label | ||
id: event-name-check | ||
if: ${{github.event_name != 'pull_request'}} | ||
run: echo "value=true" >> "$GITHUB_OUTPUT" | ||
|
||
should-run: | ||
uses: trifork/cheetah-infrastructure-utils-workflows/.github/workflows/e2e-should-run.yml@main | ||
|
||
e2e-test: | ||
needs: should-run | ||
if: ${{ needs.should-run.outputs.should-run }} | ||
runs-on: ubuntu-latest | ||
if: ${{ needs.should-run.outputs.event-name-check == 'true' || needs.should-run.outputs.tag-check == 'true' }} | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4 | ||
|
||
- name: Log in to the Container registry | ||
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.PACKAGE_PAT }} | ||
|
||
- name: Checkout trifork/cheetah-development-infrastructure | ||
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4 | ||
with: | ||
repository: trifork/cheetah-development-infrastructure | ||
token: ${{ secrets.PACKAGE_PAT }} # `PACKAGE_PAT` is a secret that contains your PAT | ||
path: integrationtests | ||
|
||
- name: "Start e2e infrastructure" | ||
working-directory: integrationtests/ | ||
run: | | ||
docker compose --profile core up -d --build | ||
env: | ||
DOCKER_REGISTRY: ghcr.io/trifork/ | ||
|
||
- name: "Wait for opensearch, the slowest component" | ||
uses: nick-fields/retry@v2 | ||
with: | ||
timeout_minutes: 3 | ||
max_attempts: 25 | ||
retry_wait_seconds: 5 | ||
warning_on_retry: false | ||
command: 'docker run --rm --network=cheetah-infrastructure badouralix/curl-jq curl -u admin:admin -sS -X GET -H "Content-Type: application/json" http://opensearch:9200/_cat/indices' | ||
|
||
- name: "Start Cheetah.Webapi (example)" | ||
working-directory: . | ||
run: docker compose up -d --build | ||
env: | ||
GITHUB_ACTOR: ${{ github.actor }} | ||
GITHUB_TOKEN: ${{ secrets.PACKAGE_PAT }} | ||
|
||
- name: "Check health" | ||
id: "integrationtest" | ||
uses: nick-fields/retry@v2 | ||
with: | ||
timeout_minutes: 1 | ||
max_attempts: 25 | ||
retry_wait_seconds: 5 | ||
warning_on_retry: false | ||
command: 'docker run --rm --network=cheetah-infrastructure badouralix/curl-jq curl -sS -X GET -H "Content-Type: application/json" http://cheetahwebapi:80/health' | ||
|
||
- name: "Check metrics" | ||
shell: bash | ||
run: | | ||
docker run --rm --network=cheetah-infrastructure badouralix/curl-jq curl -sS -X GET -H "Content-Type: application/json" http://cheetahwebapi:80/metrics | ||
- name: "Print logs" | ||
if: always() | ||
run: "docker logs src-cheetah.webapi-1" # docker compose logs |
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,13 @@ | ||
name: summary | ||
on: | ||
pull_request: | ||
jobs: | ||
enforce-all-checks: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
checks: read | ||
steps: | ||
- name: GitHub Checks | ||
uses: poseidon/[email protected] | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} |
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,35 @@ | ||
name: Create and publish Cheetah.WebApi Docker image | ||
|
||
on: | ||
workflow_dispatch: | ||
|
||
push: | ||
branches: ["main"] | ||
tags: | ||
- "v*" | ||
pull_request: | ||
branches: ["main"] | ||
|
||
env: | ||
IMAGE_NAME: trifork/cheetah-webapi # image name, must have gh org prefix | ||
ASSEMBLY_NAME: Cheetah.WebApi.dll # entrypoint assembly name | ||
PROJECT_PATH: Cheetah.WebApi/Cheetah.WebApi.csproj # path to csproj, relative to ./src (i know..) | ||
BASE_IMAGE: src/Cheetah.WebApi/Dockerfile | ||
|
||
jobs: | ||
build-and-push-image: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4 | ||
- name: "Build and push" | ||
uses: trifork/cheetah-infrastructure-utils-workflows/.github/actions/build-image@main | ||
with: | ||
read_package_pat: ${{ secrets.PACKAGE_PAT }} # we need this, as GITHUB_TOKEN only have permission to its own repo | ||
image_name: ${{ env.IMAGE_NAME }} | ||
project_path: ${{ env.PROJECT_PATH }} | ||
assembly_name: ${{ env.ASSEMBLY_NAME }} | ||
github_actor: ${{ github.actor }} | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
base_image: ${{ env.BASE_IMAGE }} | ||
github_run_id: ${{ github.run_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,31 @@ | ||
name: Create and publish Cheetah.WebApi swagger files | ||
|
||
on: | ||
workflow_dispatch: | ||
|
||
push: | ||
branches: ["main"] | ||
tags: | ||
- "v*" | ||
pull_request: | ||
branches: ["main"] | ||
|
||
env: | ||
ASSEMBLY_NAME: Cheetah.WebApi.dll # entrypoint assembly name | ||
PROJECT_PATH: src/Cheetah.WebApi | ||
SOLUTION_FILEPATH: src/Cheetah.WebApi.sln | ||
|
||
jobs: | ||
generate-swagger: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4 | ||
- name: "Generate swagger file" | ||
uses: trifork/cheetah-infrastructure-utils/.github/actions/generate-swagger@main | ||
with: | ||
read_package_pat: ${{ secrets.PACKAGE_PAT }} # we need this, as GITHUB_TOKEN only have permission to its own repo | ||
project_path: ${{ env.PROJECT_PATH }} | ||
assembly_name: ${{ env.ASSEMBLY_NAME }} | ||
github_actor: ${{ github.actor }} | ||
solution_filepath: ${{ env.SOLUTION_FILEPATH }} |
Oops, something went wrong.