init
This commit is contained in:
parent
d5f6c43024
commit
356ca5593f
@ -25,13 +25,12 @@ spec:
|
||||
type: string
|
||||
default: ""
|
||||
|
||||
# 배열 타입으로 변경
|
||||
- name: generatorOptions
|
||||
type: string
|
||||
type: array
|
||||
description: |
|
||||
openapi-generator-cli options
|
||||
ex) "--additional-properties=key=value --enable-post-process-file"
|
||||
default: ""
|
||||
ex) ['--additional-properties=key=value', '--enable-post-process-file']
|
||||
default: []
|
||||
|
||||
workspaces:
|
||||
- name: base
|
||||
@ -41,37 +40,31 @@ spec:
|
||||
- name: output
|
||||
|
||||
steps:
|
||||
# split-arguments 단계 제거
|
||||
|
||||
- name: generate-code
|
||||
image: openapitools/openapi-generator-cli:v7.4.0
|
||||
workingDir: /workspace/base/$(params.context)/source
|
||||
env:
|
||||
- name: 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: |
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
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)
|
||||
#!/bin/bash
|
||||
OUTPUT="/workspace/base/$(params.context)/output/$(params.packageNamePrefix)$(params.specDomain)-$(date +%s)-$(head /dev/urandom | tr -dc a-z0-9 | head -c 6)""
|
||||
echo -n "${OUTPUT}" > $(results.output.path)
|
Loading…
x
Reference in New Issue
Block a user