From 8a0528977c1cb8a9a2d0d70179bb31a53bf40fa3 Mon Sep 17 00:00:00 2001 From: Tom Peltonen Date: Tue, 17 Jun 2025 07:36:38 +1000 Subject: [PATCH] Changing the default content --- rediops/default/default.json | 20 +- .../default/{ => .well-known}/devops.json | 12 +- .../default/.well-known/qaskx-config.yaml | 377 ++++++++++++++++++ .../default/build/qaskx_generate.ps1 | 47 +++ 4 files changed, 446 insertions(+), 10 deletions(-) rename rediops/default/definitions/default/{ => .well-known}/devops.json (94%) create mode 100644 rediops/default/definitions/default/.well-known/qaskx-config.yaml create mode 100644 rediops/default/definitions/default/build/qaskx_generate.ps1 diff --git a/rediops/default/default.json b/rediops/default/default.json index 4626054..9cab3da 100644 --- a/rediops/default/default.json +++ b/rediops/default/default.json @@ -4,11 +4,25 @@ "description": "devops default template", "templates": [ { - "engine": "", - "folder": "{{.SelfFolder}}/definitions/{{.TemplateName}}", + "engine": "", + "folder": "{{.SelfFolder}}/definitions/{{.TemplateName}}/.well-known", "file_name": "devops.json", "output_folder": "^/.well-known", "output_name": "devops.json" - } + }, + { + "engine": "", + "folder": "{{.SelfFolder}}/definitions/{{.TemplateName}}/.well-known", + "file_name": "qaskx-config.yaml", + "output_folder": "^/.well-known", + "output_name": "qaskx-config.yaml" + }, + { + "engine": "", + "folder": "{{.SelfFolder}}/definitions/{{.TemplateName}}/build", + "file_name": "*", + "output_folder": "^/build", + "output_name": "" + } ] } \ No newline at end of file diff --git a/rediops/default/definitions/default/devops.json b/rediops/default/definitions/default/.well-known/devops.json similarity index 94% rename from rediops/default/definitions/default/devops.json rename to rediops/default/definitions/default/.well-known/devops.json index b44ad06..a74fb83 100644 --- a/rediops/default/definitions/default/devops.json +++ b/rediops/default/definitions/default/.well-known/devops.json @@ -89,10 +89,8 @@ }, "deploy": [ { - "commands": { - "platform": "", - "script": "" - }, + "platform": "", + "script": "", "deploy": { "category": "DEPLOY", "name": "rpm", @@ -114,17 +112,17 @@ "owner": { "contacts": [ { - "address": "qaskx.slack.com", + "address": "CHANGE.ME.slack.com", "name": "SLACK" }, { - "address": "@qaskx:qaskx.one", + "address": "@CHANGE.MME:qaskx.one", "name": "MATRIX" } ], "email": "{{.OwnerEmail}}", "name": "{{.OwnerName}}", - "web": "https://" + "web": "https://CHANGE.ME" }, "repository": { "source": { diff --git a/rediops/default/definitions/default/.well-known/qaskx-config.yaml b/rediops/default/definitions/default/.well-known/qaskx-config.yaml new file mode 100644 index 0000000..1650360 --- /dev/null +++ b/rediops/default/definitions/default/.well-known/qaskx-config.yaml @@ -0,0 +1,377 @@ +app: + name: Example CHANGE.ME Application + version: 0.0.1 +rediops: + depend: "" +generator_handlers: + generators: {} +run: + container: + engine: docker +templates: + cache_off: false + fall_back: null + root_folder: "" + groups: {} +logger: + provider: "" + log_level_base: "" + log_level: 1 + log_writer: "" + log_path: "" + log_cmd_count: 0 +vault_file: "" +file_format: + left_quote: "" + right_quote: "" + separator: "" + escape_match: "" + escape_value: "" +lock_modify: false +validation: + default_level: DETAIL +scan: + options: + skip_file: "" + regex_file: "" + skip_files: [] + regex: [] +activities: + engines: + - osEnvironment: windows + category: BUILD + id: '*default' + name: Default Windows engine + command: pwsh.exe + option: -Command + - osEnvironment: windows + category: BUILD + id: pwsh-command + name: "" + command: pwsh.exe + option: -Command + - osEnvironment: windows + category: BUILD + id: pwsh-script + name: "" + command: pwsh.exe + option: -File + - osEnvironment: windows + category: BUILD + id: cmd-command + name: "" + command: cmd.exe + option: "" + - osEnvironment: linux + category: BUILD + id: '*default' + name: Default Linux engine + command: /bin/sh + option: -c + - osEnvironment: linux + category: BUILD + id: pwsh-command + name: "" + command: pwsh + option: -Command + - osEnvironment: linux + category: BUILD + id: pwsh-script + name: "" + command: pwsh + option: -File + - osEnvironment: darwin + category: BUILD + id: '*default' + name: "" + command: /bin/sh + option: -c + - osEnvironment: windows + category: TEST + id: '*default' + name: Default Windows engine + command: pwsh.exe + option: -Command + - osEnvironment: windows + category: TEST + id: pwsh-command + name: "" + command: pwsh.exe + option: -Command + - osEnvironment: windows + category: TEST + id: pwsh-script + name: "" + command: pwsh.exe + option: -File + - osEnvironment: windows + category: TEST + id: cmd-command + name: "" + command: cmd.exe + option: "" + - osEnvironment: linux + category: TEST + id: '*default' + name: Default Linux engine + command: /bin/sh + option: -c + - osEnvironment: linux + category: TEST + id: pwsh-command + name: "" + command: pwsh + option: -Command + - osEnvironment: linux + category: TEST + id: pwsh-script + name: "" + command: pwsh + option: -File + - osEnvironment: darwin + category: TEST + id: '*default' + name: "" + command: /bin/sh + option: -c + - osEnvironment: windows + category: DEPLOY + id: '*default' + name: Default Windows engine + command: pwsh.exe + option: -Command + - osEnvironment: windows + category: DEPLOY + id: pwsh-command + name: "" + command: pwsh.exe + option: -Command + - osEnvironment: windows + category: DEPLOY + id: pwsh-script + name: "" + command: pwsh.exe + option: -File + - osEnvironment: windows + category: DEPLOY + id: cmd-command + name: "" + command: cmd.exe + option: "" + - osEnvironment: linux + category: DEPLOY + id: '*default' + name: Default Linux engine + command: /bin/sh + option: -c + - osEnvironment: linux + category: DEPLOY + id: pwsh-command + name: "" + command: pwsh + option: -Command + - osEnvironment: linux + category: DEPLOY + id: pwsh-script + name: "" + command: pwsh + option: -File + - osEnvironment: darwin + category: DEPLOY + id: '*default' + name: "" + command: /bin/sh + option: -c + - osEnvironment: windows + category: SOURCE + id: '*default' + name: Default Windows engine + command: pwsh.exe + option: -Command + - osEnvironment: windows + category: SOURCE + id: pwsh-command + name: "" + command: pwsh.exe + option: -Command + - osEnvironment: windows + category: SOURCE + id: pwsh-script + name: "" + command: pwsh.exe + option: -File + - osEnvironment: windows + category: SOURCE + id: cmd-command + name: "" + command: cmd.exe + option: "" + - osEnvironment: linux + category: SOURCE + id: '*default' + name: Default Linux engine + command: /bin/sh + option: -c + - osEnvironment: linux + category: SOURCE + id: pwsh-command + name: "" + command: pwsh + option: -Command + - osEnvironment: linux + category: SOURCE + id: pwsh-script + name: "" + command: pwsh + option: -File + - osEnvironment: darwin + category: SOURCE + id: '*default' + name: "" + command: /bin/sh + option: -c + - osEnvironment: windows + category: RELEASE + id: '*default' + name: Default Windows engine + command: pwsh.exe + option: -Command + - osEnvironment: windows + category: RELEASE + id: pwsh-command + name: "" + command: pwsh.exe + option: -Command + - osEnvironment: windows + category: RELEASE + id: pwsh-script + name: "" + command: pwsh.exe + option: -File + - osEnvironment: windows + category: RELEASE + id: cmd-command + name: "" + command: cmd.exe + option: "" + - osEnvironment: linux + category: RELEASE + id: '*default' + name: Default Linux engine + command: /bin/sh + option: -c + - osEnvironment: linux + category: RELEASE + id: pwsh-command + name: "" + command: pwsh + option: -Command + - osEnvironment: linux + category: RELEASE + id: pwsh-script + name: "" + command: pwsh + option: -File + - osEnvironment: darwin + category: RELEASE + id: '*default' + name: "" + command: /bin/sh + option: -c + - osEnvironment: windows + category: TOOL + id: '*default' + name: Default Windows engine + command: pwsh.exe + option: -Command + - osEnvironment: windows + category: TOOL + id: pwsh-command + name: "" + command: pwsh.exe + option: -Command + - osEnvironment: windows + category: TOOL + id: pwsh-script + name: "" + command: pwsh.exe + option: -File + - osEnvironment: windows + category: TOOL + id: cmd-command + name: "" + command: cmd.exe + option: "" + - osEnvironment: linux + category: TOOL + id: '*default' + name: Default Linux engine + command: /bin/sh + option: -c + - osEnvironment: linux + category: TOOL + id: pwsh-command + name: "" + command: pwsh + option: -Command + - osEnvironment: linux + category: TOOL + id: pwsh-script + name: "" + command: pwsh + option: -File + - osEnvironment: darwin + category: TOOL + id: '*default' + name: "" + command: /bin/sh + option: -c + - osEnvironment: windows + category: REFRESH + id: '*default' + name: Default Windows engine + command: pwsh.exe + option: -Command + - osEnvironment: windows + category: REFRESH + id: pwsh-command + name: "" + command: pwsh.exe + option: -Command + - osEnvironment: windows + category: REFRESH + id: pwsh-script + name: "" + command: pwsh.exe + option: -File + - osEnvironment: windows + category: REFRESH + id: cmd-command + name: "" + command: cmd.exe + option: "" + - osEnvironment: linux + category: REFRESH + id: '*default' + name: Default Linux engine + command: /bin/sh + option: -c + - osEnvironment: linux + category: REFRESH + id: pwsh-command + name: "" + command: pwsh + option: -Command + - osEnvironment: linux + category: REFRESH + id: pwsh-script + name: "" + command: pwsh + option: -File + - osEnvironment: darwin + category: REFRESH + id: '*default' + name: "" + command: /bin/sh + option: -c +git_embedded: false diff --git a/rediops/default/definitions/default/build/qaskx_generate.ps1 b/rediops/default/definitions/default/build/qaskx_generate.ps1 new file mode 100644 index 0000000..14bb98c --- /dev/null +++ b/rediops/default/definitions/default/build/qaskx_generate.ps1 @@ -0,0 +1,47 @@ +param ( + [Parameter(Mandatory=$true)][string] $OpenAPI +) + +$startCd = Get-Location + +$prjDir = qaskx-cli tools dir + +if ($prjDir -eq "") { + Throw "No home project directory found" +} + +Write-Host "Project home dir: $prjDir" +Set-Location $prjDir + +# Fetch oapigen if it does not exist +$binFolder = Join-Path -Path $prjDir -Child "build" +$oapigenItem = Join-Path -Path $binFolder -Child "oapigen.exe" +if ( (Test-Path $oapigenItem -PathType Leaf) -eq $false) { + $binTmpFolder = "tmp" + $oapigenItem = Join-Path -Path $binTmpFolder -Child "oapigen.exe" + if ( (Test-Path $oapigenItem -PathType Leaf) -eq $false) { + # TODO: Download artefact + } + + if ( (Test-Path $oapigenItem -PathType Leaf) -eq $false) { + throw "oapigen.exe not found nor downloaded" + } +} + + +$genFolder = Join-Path -Path $prjDir -ChildPath "internal/controller/http/api/gen" +if ( (Test-Path $genFolder -PathType Container) -eq $false) { + $genFolder = Join-Path -Path $genFolder -ChildPath "internal/controller/http/api" + New-Item -Path $genFolder -Name "gen" -ItemType Directory -Force +} + +$configFile = Join-Path -Path $prjDir -ChildPath ".\build\types.cfg.yaml" +& $oapigenItem --config $configFile $OpenAPI +Write-Host "API type code generated" + +$configFile = Join-Path -Path $prjDir -ChildPath ".\build\server.cfg.yaml" +& $oapigenItem --config $configFile $OpenAPI +Write-Host "API server code generated" + +Set-Location $startCd +Write-Host "Generation complete. Please check logs." -ForegroundColor Yellow