Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
properties([
    parameters([
      [
            $class: 'DynamicReferenceParameter',
            choiceType: 'ET_FORMATTED_HTML',
            referencedParameters: 'DEPLOY_SERVER_NAME',
            name: 'SERVER_URL',
            description: '배포할 서버 Backend URL(스키마 로드)',
            omitValueField: true,
            script: [
                $class: 'GroovyScript',
                script: [
                    classpath: [],
                    sandbox: false,
                    script: '''
                        switch(DEPLOY_SERVER_NAME){
                            case~/.*devapi01.*/:
                                return """<input name="value" value="http://dev-api.justten.io" class="setting-input" type="text">"""
                                break
                            default:
                                return ""
                                break
                        }
                    '''
                ],
                fallbackScript: [
                    classpath: [],
                    sandbox: false,
                    script: "return ''"
                ],
            ]
        ]
    ])
])      

예시 - 개발서버 1대

  • value: devapi01

  • DEPLOY_SERVER_NAME

    • case: devapi01

    • value: 배포할 URL

Code Block
properties([
    parameters([
        [
            $class: 'ExtendedChoiceParameterDefinition',
            type: 'PT_MULTI_SELECT',
            name: 'DEPLOY_SERVER_NAME',
            value: 'devapi01',
            defaultValue: 'devapi01',
            description: '배포할 서버',
            visibleItemCount: '1'
        ],
        [
            $class: 'DynamicReferenceParameter',
            choiceType: 'ET_FORMATTED_HTML',
            referencedParameters: 'DEPLOY_SERVER_NAME',
            name: 'SERVER_URL',
            description: '배포할 서버 Backend URL(스키마 로드)',
            omitValueField: true,
            script: [
                $class: 'GroovyScript',
                script: [
                    classpath: [],
                    sandbox: false,
                    script: '''
                        switch(DEPLOY_SERVER_NAME){
                            case~/.*devapi01.*/:
                                return """<input name="value" value="http://dev-api.justten.io" class="setting-input" type="text">"""
                                break
                            default:
                                return ""
                                break
                        }
                    '''
                ],
                fallbackScript: [
                    classpath: [],
                    sandbox: false,
                    script: "return ''"
                ],
            ]
        ]
    ])
])

예시 - 운영서버 1대

  • value: prdapi01, prdapi02

  • DEPLOY_SERVER_NAME

    • case: prdapi01

      • value: prdapi01, prdapi02

      • DEPLOY_SERVER_NAME

        • case: prdapi01

          • value: 배포할 IP:PORT 혹은 URL

        • case: prdapi02

          • value: 배포할 IP:PORT 혹은 URL

      • Code Block
        properties([
            parameters([
                [
                    $class: 'ExtendedChoiceParameterDefinition',
                    type: 'PT_MULTI_SELECT',
                    name: 'DEPLOY_SERVER_NAME',
                    value: 'prdapi01,prdapi02',
                    defaultValue: 'prdapi01',
                    description: '배포할 서버',
                    visibleItemCount: '1'
                ],
                [
                    $class: 'DynamicReferenceParameter',
                    choiceType: 'ET_FORMATTED_HTML',
                    referencedParameters: 'DEPLOY_SERVER_NAME',
                    name: 'SERVER_URL',
                    description: '배포할 서버 Backend URL(스키마 로드)',
                    omitValueField: true,
                    script: [
                        $class: 'GroovyScript',
                        script: [
                            classpath: [],
                            sandbox: false,
                            script: '''
                                switch(DEPLOY_SERVER_NAME){
                                    case~/.*prdapi01.*/:
                                        return """<input name="value" value="http://api.justten.io" class="setting-input" type="text">"""
                                        break
                                    case~/.*prdapi02.*/:
                                        return """<input name="value" value="http://api.justten.io" class="setting-input" type="text">"""
                                        break
                                    default:
                                        return ""
                                        break
                                }
                            '''
                        ],
                        fallbackScript: [
                            classpath: [],
                            sandbox: false,
                            script: "return ''"
                        ],
                    ]
                ]
            ])
        ])