Skip to content

bugfix for swagger API when BaseURL is non-empty #425

bugfix for swagger API when BaseURL is non-empty

bugfix for swagger API when BaseURL is non-empty #425

Workflow file for this run

name: build
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
on:
push:
tags:
- '*.*.*'
jobs:
build-publish-backend-base:
runs-on: ubuntu-20.04
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Setup .NET 7.0.x
uses: actions/setup-dotnet@v1
with:
dotnet-version: '7.0.x'
- name: Set version
run: echo "VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: Build and publish
run: |
cd backend
dotnet nuget add source https://nuget.pkg.github.com/max-bytes/index.json --name "Github nuget Repository" --username "${{ github.actor }}" --password "${{ secrets.GITHUB_TOKEN }}" --store-password-in-clear-text
dotnet pack Omnikeeper.Base/Omnikeeper.Base.csproj /p:Version=${{ env.VERSION }} -c Release
dotnet nuget push "Omnikeeper.Base/bin/Release/Omnikeeper.Base.${{ env.VERSION }}.nupkg" --source "Github nuget Repository"
build-backend-vanilla: # backend docker container without plugins
runs-on: ubuntu-20.04
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Log in to the Container registry
uses: docker/login-action@v1
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set version
run: echo "VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v3
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}/core/backend
- name: Build and push Docker images
uses: docker/build-push-action@v2
with:
context: "./backend"
file: "./backend/Omnikeeper/Dockerfile"
push: true
build-args: |
version=${{ env.VERSION }}
nugetRepoUser=${{ github.actor }}
nugetRepoPassword=${{ secrets.GITHUB_TOKEN }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-publish-frontend-okplugin-generic-json-ingest:
runs-on: ubuntu-20.04
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set version
run: echo "VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: Build and publish
env:
ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPOURL: npm.pkg.github.com/
PLUGIN_FOLDER: okplugin-generic-json-ingest
run: |
cd frontend/$PLUGIN_FOLDER
npm ci --legacy-peer-deps # --legacy-peer-deps is necessary because npm 7 changed the way peer dependencies are handled
cat <<'EOF' > .npmrc
//${REPOURL}:_authToken=${ACCESS_TOKEN}
@max-bytes:registry=https://npm.pkg.github.com
EOF
npm version ${{ env.VERSION }} # set version
npm publish
build-publish-frontend-okplugin-visualization:
runs-on: ubuntu-20.04
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set version
run: echo "VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: Build and publish
env:
ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPOURL: npm.pkg.github.com/
PLUGIN_FOLDER: okplugin-visualization
run: |
cd frontend/$PLUGIN_FOLDER
npm ci --legacy-peer-deps # --legacy-peer-deps is necessary because npm 7 changed the way peer dependencies are handled
cat <<'EOF' > .npmrc
//${REPOURL}:_authToken=${ACCESS_TOKEN}
@max-bytes:registry=https://npm.pkg.github.com
EOF
npm version ${{ env.VERSION }} # set version
npm publish
build-publish-backend-okplugins:
runs-on: ubuntu-20.04
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Setup .NET 7.0.x
uses: actions/setup-dotnet@v1
with:
dotnet-version: '7.0.x'
- name: Set version
run: echo "VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: Build and publish
run: |
cd backend
function buildPublish () {
dotnet pack $1/$1.csproj /p:Version=${{ env.VERSION }} -c Release
# pushing seems to not work sometimes, see https://github.com/NuGet/Home/issues/8580#issuecomment-714501802
dotnet nuget push "$1/bin/Release/$1.${{ env.VERSION }}.nupkg" --source "https://nuget.pkg.github.com/max-bytes/index.json" -k "${{ secrets.GITHUB_TOKEN }}" --skip-duplicate
}
buildPublish OKPluginGenericJSONIngest
buildPublish OKPluginInsightDiscoveryScanIngest
#buildPublish OKPluginOIASharepoint
#buildPublish OKPluginOIAOmnikeeper
#buildPublish OKPluginOIAKeycloak
#buildPublish OKPluginCLBMonitoring
#buildPublish OKPluginCLBNaemonVariableResolution
#buildPublish OKPluginCLBVariableRendering
#buildPublish OKPluginCLBNaemonConfig
buildPublish OKPluginAnsibleInventoryScanIngest
buildPublish OKPluginActiveDirectoryXMLIngest
buildPublish OKPluginVisualization
build-swagger-definition:
runs-on: ubuntu-20.04
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Build
run: |
# TODO, HACK: we haven't found a good way to generate client APIs for plugin endpoints, so we fallback to a static swagger definition file
cp clients/source/omnikeeper_static.json omnikeeper.json
# HACK: commented out code for dynamically creating a swagger definition file
# cd backend
# dotnet nuget remove source "nuget Repository" # HACK: we need to remove the internal repo, nuget is stupid :(
# dotnet build "Omnikeeper/Omnikeeper.csproj" -c Release
# cd Omnikeeper
# dotnet tool restore
# dotnet swagger tofile --output ../../omnikeeper.json ./bin/Release/net7.0/Omnikeeper.dll v1
- uses: actions/upload-artifact@v2
with:
name: omnikeeper-swagger-json
path: omnikeeper.json
run-perf-tests:
runs-on: ubuntu-20.04
steps:
- name: "Invoke perf-tests workflow"
uses: benc-uk/workflow-dispatch@v1
with:
workflow: run-perf-tests
token: ${{ secrets.PAT }}
run-tests:
runs-on: ubuntu-20.04
steps:
- name: "Invoke tests workflow"
uses: benc-uk/workflow-dispatch@v1
with:
workflow: run-tests
token: ${{ secrets.PAT }}
publish-client-libraries:
runs-on: ubuntu-20.04
needs: build-swagger-definition
env:
ACCESS_TOKEN_REPO_CLIENT_GO: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set version
run: echo "VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- uses: actions/download-artifact@v2
with:
name: omnikeeper-swagger-json
- name: Build
run: |
bash clients/scripts/go/generate_publish.sh github.com omnikeeper.json ${{ env.VERSION }} "max-bytes" "${{ secrets.CLIENT_LIBRARY_DEPLOY_TOKEN_GO }}"
bash clients/scripts/java/generate_publish.sh github.com omnikeeper.json ${{ env.VERSION }} "max-bytes" "${{ secrets.CLIENT_LIBRARY_DEPLOY_TOKEN_JAVA }}"
bash clients/scripts/powershell/generate_publish.sh github.com omnikeeper.json ${{ env.VERSION }} "max-bytes" "${{ secrets.CLIENT_LIBRARY_DEPLOY_TOKEN_POWERSHELL }}"
call-backend-package-variants:
runs-on: ubuntu-20.04
needs: [build-backend-vanilla, build-publish-backend-okplugins]
steps:
- name: Set version
run: echo "VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: "Invoke backend packaging variants"
uses: benc-uk/workflow-dispatch@v1
with:
workflow: call-backend-package-variants
token: ${{ secrets.PAT }}
inputs: '{ "baseVersion": "${{ env.VERSION }}" }'
call-frontend-package-variants:
runs-on: ubuntu-20.04
needs: [build-publish-frontend-okplugin-generic-json-ingest, build-publish-frontend-okplugin-visualization]
steps:
- name: Set version
run: echo "VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: "Invoke frontend packaging variants"
uses: benc-uk/workflow-dispatch@v1
with:
workflow: call-frontend-package-variants
token: ${{ secrets.PAT }}
inputs: '{ "baseVersion": "${{ env.VERSION }}" }'