init
This commit is contained in:
parent
d5f6c43024
commit
356ca5593f
@ -25,13 +25,12 @@ spec:
|
|||||||
type: string
|
type: string
|
||||||
default: ""
|
default: ""
|
||||||
|
|
||||||
# 배열 타입으로 변경
|
|
||||||
- name: generatorOptions
|
- name: generatorOptions
|
||||||
type: string
|
type: array
|
||||||
description: |
|
description: |
|
||||||
openapi-generator-cli options
|
openapi-generator-cli options
|
||||||
ex) "--additional-properties=key=value --enable-post-process-file"
|
ex) ['--additional-properties=key=value', '--enable-post-process-file']
|
||||||
default: ""
|
default: []
|
||||||
|
|
||||||
workspaces:
|
workspaces:
|
||||||
- name: base
|
- name: base
|
||||||
@ -41,37 +40,31 @@ spec:
|
|||||||
- name: output
|
- name: output
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
# split-arguments 단계 제거
|
|
||||||
|
|
||||||
- name: generate-code
|
- name: generate-code
|
||||||
image: openapitools/openapi-generator-cli:v7.4.0
|
image: openapitools/openapi-generator-cli:v7.4.0
|
||||||
workingDir: /workspace/base/$(params.context)/source
|
workingDir: /workspace/base/$(params.context)/source
|
||||||
env:
|
env:
|
||||||
- name: HOME
|
- name: HOME
|
||||||
value: /workspace/base/$(params.context)/home
|
value: /workspace/base/$(params.context)/home
|
||||||
|
command:
|
||||||
|
- openapi-generator-cli
|
||||||
|
args:
|
||||||
|
- generate
|
||||||
|
- -i
|
||||||
|
- specs/$(params.specDomain)/openapi.yaml
|
||||||
|
- -g
|
||||||
|
- $(params.generator)
|
||||||
|
- -o
|
||||||
|
- "/workspace/base/$(params.context)/output/$(params.packageNamePrefix)$(params.specDomain)-$(date +%s)-$(head /dev/urandom | tr -dc a-z0-9 | head -c 6)"
|
||||||
|
- --additional-properties=packageName=$(params.packageNamePrefix)$(params.context)
|
||||||
|
- --additional-properties=packageVersion=$(params.version)
|
||||||
|
- --additional-properties=publish=true
|
||||||
|
- --additional-properties=disableValidator=false
|
||||||
|
- $(params.generatorOptions[*]) # 배열 확장
|
||||||
|
|
||||||
|
- name: write-output-result
|
||||||
|
image: bash:latest
|
||||||
script: |
|
script: |
|
||||||
#!/usr/bin/env bash
|
#!/bin/bash
|
||||||
set -e
|
OUTPUT="/workspace/base/$(params.context)/output/$(params.packageNamePrefix)$(params.specDomain)-$(date +%s)-$(head /dev/urandom | tr -dc a-z0-9 | head -c 6)""
|
||||||
|
|
||||||
OPENAPI_FILE="specs/$(params.specDomain)/openapi.yaml"
|
|
||||||
PACKAGE_NAME="$(params.packageNamePrefix)$(params.context)"
|
|
||||||
OUTPUT="/workspace/base/$(params.context)/output/${PACKAGE_NAME}-$(date +%s)-$(head /dev/urandom | tr -dc a-z0-9 | head -c 6)"
|
|
||||||
|
|
||||||
if [ ! -d "$OUTPUT" ]; then
|
|
||||||
mkdir -p "$OUTPUT"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# 문자열을 배열로 변환
|
|
||||||
IFS=' ' read -ra GENERATOR_OPTIONS <<< "$(params.generatorOptions)"
|
|
||||||
|
|
||||||
openapi-generator-cli generate \
|
|
||||||
-i ${OPENAPI_FILE} \
|
|
||||||
-g $(params.generator) \
|
|
||||||
-o $OUTPUT \
|
|
||||||
--additional-properties=packageName="${PACKAGE_NAME}" \
|
|
||||||
--additional-properties=packageVersion=$(params.version) \
|
|
||||||
--additional-properties=publish=true \
|
|
||||||
--additional-properties=disableValidator=false \
|
|
||||||
"${GENERATOR_OPTIONS[@]}" # 배열 확장
|
|
||||||
|
|
||||||
echo -n "${OUTPUT}" > $(results.output.path)
|
echo -n "${OUTPUT}" > $(results.output.path)
|
Loading…
x
Reference in New Issue
Block a user