1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2025-07-15 01:34:38 +02:00

IntegrationArtifactGetServiceEndpoint Command (#2582)

* GetIntegrationArtifactServiceEndpoint Command

Co-authored-by: Marcus Holl <marcus.holl@sap.com>
This commit is contained in:
Mayur Belur Mohan
2021-02-05 15:05:55 +05:30
committed by GitHub
parent 3a49bcafc9
commit 538256774a
11 changed files with 607 additions and 0 deletions

View File

@ -0,0 +1,119 @@
package cmd
import (
"fmt"
"io/ioutil"
"net/http"
"strings"
"github.com/Jeffail/gabs/v2"
"github.com/SAP/jenkins-library/pkg/command"
"github.com/SAP/jenkins-library/pkg/cpi"
piperhttp "github.com/SAP/jenkins-library/pkg/http"
"github.com/SAP/jenkins-library/pkg/log"
"github.com/SAP/jenkins-library/pkg/telemetry"
"github.com/pkg/errors"
)
type integrationArtifactGetServiceEndpointUtils interface {
command.ExecRunner
// Add more methods here, or embed additional interfaces, or remove/replace as required.
// The integrationArtifactGetServiceEndpointUtils interface should be descriptive of your runtime dependencies,
// i.e. include everything you need to be able to mock in tests.
// Unit tests shall be executable in parallel (not depend on global state), and don't (re-)test dependencies.
}
type integrationArtifactGetServiceEndpointUtilsBundle struct {
*command.Command
// Embed more structs as necessary to implement methods or interfaces you add to integrationArtifactGetServiceEndpointUtils.
// Structs embedded in this way must each have a unique set of methods attached.
// If there is no struct which implements the method you need, attach the method to
// integrationArtifactGetServiceEndpointUtilsBundle and forward to the implementation of the dependency.
}
func newIntegrationArtifactGetServiceEndpointUtils() integrationArtifactGetServiceEndpointUtils {
utils := integrationArtifactGetServiceEndpointUtilsBundle{
Command: &command.Command{},
}
// Reroute command output to logging framework
utils.Stdout(log.Writer())
utils.Stderr(log.Writer())
return &utils
}
func integrationArtifactGetServiceEndpoint(config integrationArtifactGetServiceEndpointOptions, telemetryData *telemetry.CustomData, commonPipelineEnvironment *integrationArtifactGetServiceEndpointCommonPipelineEnvironment) {
// Utils can be used wherever the command.ExecRunner interface is expected.
// It can also be used for example as a mavenExecRunner.
httpClient := &piperhttp.Client{}
// For HTTP calls import piperhttp "github.com/SAP/jenkins-library/pkg/http"
// and use a &piperhttp.Client{} in a custom system
// Example: step checkmarxExecuteScan.go
// Error situations should be bubbled up until they reach the line below which will then stop execution
// through the log.Entry().Fatal() call leading to an os.Exit(1) in the end.
err := runIntegrationArtifactGetServiceEndpoint(&config, telemetryData, httpClient, commonPipelineEnvironment)
if err != nil {
log.Entry().WithError(err).Fatal("step execution failed")
}
}
func runIntegrationArtifactGetServiceEndpoint(config *integrationArtifactGetServiceEndpointOptions, telemetryData *telemetry.CustomData, httpClient piperhttp.Sender, commonPipelineEnvironment *integrationArtifactGetServiceEndpointCommonPipelineEnvironment) error {
clientOptions := piperhttp.ClientOptions{}
header := make(http.Header)
header.Add("Accept", "application/json")
servieEndpointURL := fmt.Sprintf("%s/api/v1/ServiceEndpoints?$expand=EntryPoints", config.Host)
tokenParameters := cpi.TokenParameters{TokenURL: config.OAuthTokenProviderURL, Username: config.Username, Password: config.Password, Client: httpClient}
token, err := cpi.CommonUtils.GetBearerToken(tokenParameters)
if err != nil {
return errors.Wrap(err, "failed to fetch Bearer Token")
}
clientOptions.Token = fmt.Sprintf("Bearer %s", token)
httpClient.SetOptions(clientOptions)
httpMethod := "GET"
serviceEndpointResp, httpErr := httpClient.SendRequest(httpMethod, servieEndpointURL, nil, header, nil)
if httpErr != nil {
return errors.Wrapf(httpErr, "HTTP %v request to %v failed with error", httpMethod, servieEndpointURL)
}
if serviceEndpointResp != nil && serviceEndpointResp.Body != nil {
defer serviceEndpointResp.Body.Close()
}
if serviceEndpointResp == nil {
return errors.Errorf("did not retrieve a HTTP response: %v", httpErr)
}
if serviceEndpointResp.StatusCode == 200 {
bodyText, readErr := ioutil.ReadAll(serviceEndpointResp.Body)
if readErr != nil {
return errors.Wrap(readErr, "HTTP response body could not be read")
}
jsonResponse, parsingErr := gabs.ParseJSON([]byte(bodyText))
if parsingErr != nil {
return errors.Wrapf(parsingErr, "HTTP response body could not be parsed as JSON: %v", string(bodyText))
}
for _, child := range jsonResponse.S("d", "results").Children() {
iflowID := strings.ReplaceAll(child.Path("Name").String(), "\"", "")
if iflowID == config.IntegrationFlowID {
entryPoints := child.S("EntryPoints")
finalEndpoint := entryPoints.Path("results.0.Url").Data().(string)
commonPipelineEnvironment.custom.iFlowServiceEndpoint = finalEndpoint
return nil
}
}
}
responseBody, readErr := ioutil.ReadAll(serviceEndpointResp.Body)
if readErr != nil {
return errors.Wrapf(readErr, "HTTP response body could not be read, Response status code: %v", serviceEndpointResp.StatusCode)
}
log.Entry().Errorf("a HTTP error occurred! Response body: %v, Response status code: %v", responseBody, serviceEndpointResp.StatusCode)
return errors.Errorf("Unable to get integration flow service endpoint, Response Status code: %v", serviceEndpointResp.StatusCode)
}

View File

@ -0,0 +1,217 @@
// Code generated by piper's step-generator. DO NOT EDIT.
package cmd
import (
"fmt"
"os"
"path/filepath"
"time"
"github.com/SAP/jenkins-library/pkg/config"
"github.com/SAP/jenkins-library/pkg/log"
"github.com/SAP/jenkins-library/pkg/piperenv"
"github.com/SAP/jenkins-library/pkg/telemetry"
"github.com/spf13/cobra"
)
type integrationArtifactGetServiceEndpointOptions struct {
Username string `json:"username,omitempty"`
Password string `json:"password,omitempty"`
IntegrationFlowID string `json:"integrationFlowId,omitempty"`
Platform string `json:"platform,omitempty"`
Host string `json:"host,omitempty"`
OAuthTokenProviderURL string `json:"oAuthTokenProviderUrl,omitempty"`
}
type integrationArtifactGetServiceEndpointCommonPipelineEnvironment struct {
custom struct {
iFlowServiceEndpoint string
}
}
func (p *integrationArtifactGetServiceEndpointCommonPipelineEnvironment) persist(path, resourceName string) {
content := []struct {
category string
name string
value interface{}
}{
{category: "custom", name: "iFlowServiceEndpoint", value: p.custom.iFlowServiceEndpoint},
}
errCount := 0
for _, param := range content {
err := piperenv.SetResourceParameter(path, resourceName, filepath.Join(param.category, param.name), param.value)
if err != nil {
log.Entry().WithError(err).Error("Error persisting piper environment.")
errCount++
}
}
if errCount > 0 {
log.Entry().Fatal("failed to persist Piper environment")
}
}
// IntegrationArtifactGetServiceEndpointCommand Get an deployed CPI intgeration flow service endpoint
func IntegrationArtifactGetServiceEndpointCommand() *cobra.Command {
const STEP_NAME = "integrationArtifactGetServiceEndpoint"
metadata := integrationArtifactGetServiceEndpointMetadata()
var stepConfig integrationArtifactGetServiceEndpointOptions
var startTime time.Time
var commonPipelineEnvironment integrationArtifactGetServiceEndpointCommonPipelineEnvironment
var createIntegrationArtifactGetServiceEndpointCmd = &cobra.Command{
Use: STEP_NAME,
Short: "Get an deployed CPI intgeration flow service endpoint",
Long: `With this step you can obtain information about the service endpoints exposed by SAP Cloud Platform Integration on a tenant using OData API.Learn more about the SAP Cloud Integration remote API for getting service endpoint of deployed integration artifact [here](https://help.sap.com/viewer/368c481cd6954bdfa5d0435479fd4eaf/Cloud/en-US/26797fbe259349b387a74a5a8f9785c1.html).`,
PreRunE: func(cmd *cobra.Command, _ []string) error {
startTime = time.Now()
log.SetStepName(STEP_NAME)
log.SetVerbose(GeneralConfig.Verbose)
path, _ := os.Getwd()
fatalHook := &log.FatalHook{CorrelationID: GeneralConfig.CorrelationID, Path: path}
log.RegisterHook(fatalHook)
err := PrepareConfig(cmd, &metadata, STEP_NAME, &stepConfig, config.OpenPiperFile)
if err != nil {
log.SetErrorCategory(log.ErrorConfiguration)
return err
}
log.RegisterSecret(stepConfig.Username)
log.RegisterSecret(stepConfig.Password)
if len(GeneralConfig.HookConfig.SentryConfig.Dsn) > 0 {
sentryHook := log.NewSentryHook(GeneralConfig.HookConfig.SentryConfig.Dsn, GeneralConfig.CorrelationID)
log.RegisterHook(&sentryHook)
}
return nil
},
Run: func(_ *cobra.Command, _ []string) {
telemetryData := telemetry.CustomData{}
telemetryData.ErrorCode = "1"
handler := func() {
config.RemoveVaultSecretFiles()
commonPipelineEnvironment.persist(GeneralConfig.EnvRootPath, "commonPipelineEnvironment")
telemetryData.Duration = fmt.Sprintf("%v", time.Since(startTime).Milliseconds())
telemetryData.ErrorCategory = log.GetErrorCategory().String()
telemetry.Send(&telemetryData)
}
log.DeferExitHandler(handler)
defer handler()
telemetry.Initialize(GeneralConfig.NoTelemetry, STEP_NAME)
integrationArtifactGetServiceEndpoint(stepConfig, &telemetryData, &commonPipelineEnvironment)
telemetryData.ErrorCode = "0"
log.Entry().Info("SUCCESS")
},
}
addIntegrationArtifactGetServiceEndpointFlags(createIntegrationArtifactGetServiceEndpointCmd, &stepConfig)
return createIntegrationArtifactGetServiceEndpointCmd
}
func addIntegrationArtifactGetServiceEndpointFlags(cmd *cobra.Command, stepConfig *integrationArtifactGetServiceEndpointOptions) {
cmd.Flags().StringVar(&stepConfig.Username, "username", os.Getenv("PIPER_username"), "User to authenticate to the SAP Cloud Platform Integration Service")
cmd.Flags().StringVar(&stepConfig.Password, "password", os.Getenv("PIPER_password"), "Password to authenticate to the SAP Cloud Platform Integration Service")
cmd.Flags().StringVar(&stepConfig.IntegrationFlowID, "integrationFlowId", os.Getenv("PIPER_integrationFlowId"), "Specifies the ID of the Integration Flow artifact")
cmd.Flags().StringVar(&stepConfig.Platform, "platform", os.Getenv("PIPER_platform"), "Specifies the running platform of the SAP Cloud platform integraion service")
cmd.Flags().StringVar(&stepConfig.Host, "host", os.Getenv("PIPER_host"), "Specifies the protocol and host address, including the port. Please provide in the format `<protocol>://<host>:<port>`. Supported protocols are `http` and `https`.")
cmd.Flags().StringVar(&stepConfig.OAuthTokenProviderURL, "oAuthTokenProviderUrl", os.Getenv("PIPER_oAuthTokenProviderUrl"), "Specifies the oAuth Provider protocol and host address, including the port. Please provide in the format `<protocol>://<host>:<port>`. Supported protocols are `http` and `https`.")
cmd.MarkFlagRequired("username")
cmd.MarkFlagRequired("password")
cmd.MarkFlagRequired("integrationFlowId")
cmd.MarkFlagRequired("host")
cmd.MarkFlagRequired("oAuthTokenProviderUrl")
}
// retrieve step metadata
func integrationArtifactGetServiceEndpointMetadata() config.StepData {
var theMetaData = config.StepData{
Metadata: config.StepMetadata{
Name: "integrationArtifactGetServiceEndpoint",
Aliases: []config.Alias{},
Description: "Get an deployed CPI intgeration flow service endpoint",
},
Spec: config.StepSpec{
Inputs: config.StepInputs{
Parameters: []config.StepParameters{
{
Name: "username",
ResourceRef: []config.ResourceReference{
{
Name: "cpiCredentialsId",
Param: "username",
Type: "secret",
},
},
Scope: []string{"PARAMETERS", "STAGES", "STEPS"},
Type: "string",
Mandatory: true,
Aliases: []config.Alias{},
},
{
Name: "password",
ResourceRef: []config.ResourceReference{
{
Name: "cpiCredentialsId",
Param: "password",
Type: "secret",
},
},
Scope: []string{"PARAMETERS", "STAGES", "STEPS"},
Type: "string",
Mandatory: true,
Aliases: []config.Alias{},
},
{
Name: "integrationFlowId",
ResourceRef: []config.ResourceReference{},
Scope: []string{"PARAMETERS", "STAGES", "STEPS"},
Type: "string",
Mandatory: true,
Aliases: []config.Alias{},
},
{
Name: "platform",
ResourceRef: []config.ResourceReference{},
Scope: []string{"PARAMETERS", "STAGES", "STEPS"},
Type: "string",
Mandatory: false,
Aliases: []config.Alias{},
},
{
Name: "host",
ResourceRef: []config.ResourceReference{},
Scope: []string{"PARAMETERS", "STAGES", "STEPS"},
Type: "string",
Mandatory: true,
Aliases: []config.Alias{},
},
{
Name: "oAuthTokenProviderUrl",
ResourceRef: []config.ResourceReference{},
Scope: []string{"PARAMETERS", "STAGES", "STEPS"},
Type: "string",
Mandatory: true,
Aliases: []config.Alias{},
},
},
},
Outputs: config.StepOutputs{
Resources: []config.StepResources{
{
Name: "commonPipelineEnvironment",
Type: "piperEnvironment",
Parameters: []map[string]interface{}{
{"Name": "custom/iFlowServiceEndpoint"},
},
},
},
},
},
}
return theMetaData
}

View File

@ -0,0 +1,17 @@
package cmd
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestIntegrationArtifactGetServiceEndpointCommand(t *testing.T) {
t.Parallel()
testCmd := IntegrationArtifactGetServiceEndpointCommand()
// only high level testing performed - details are tested in step generation procedure
assert.Equal(t, "integrationArtifactGetServiceEndpoint", testCmd.Use, "command name incorrect")
}

View File

@ -0,0 +1,72 @@
package cmd
import (
"testing"
"github.com/SAP/jenkins-library/pkg/mock"
"github.com/stretchr/testify/assert"
)
type integrationArtifactGetServiceEndpointMockUtils struct {
*mock.ExecMockRunner
*mock.FilesMock
}
func newIntegrationArtifactGetServiceEndpointTestsUtils() integrationArtifactGetServiceEndpointMockUtils {
utils := integrationArtifactGetServiceEndpointMockUtils{
ExecMockRunner: &mock.ExecMockRunner{},
FilesMock: &mock.FilesMock{},
}
return utils
}
func TestRunIntegrationArtifactGetServiceEndpoint(t *testing.T) {
t.Parallel()
t.Run("Successfully Test of Get Integration Flow Service Endpoint", func(t *testing.T) {
config := integrationArtifactGetServiceEndpointOptions{
Host: "https://demo",
OAuthTokenProviderURL: "https://demo/oauth/token",
Username: "demouser",
Password: "******",
IntegrationFlowID: "CPI_IFlow_Call_using_Cert",
Platform: "cf",
}
httpClient := httpMockCpis{CPIFunction: "IntegrationArtifactGetServiceEndpoint", ResponseBody: ``, TestType: "PositiveAndGetetIntegrationArtifactGetServiceResBody"}
seOut := integrationArtifactGetServiceEndpointCommonPipelineEnvironment{}
err := runIntegrationArtifactGetServiceEndpoint(&config, nil, &httpClient, &seOut)
assert.EqualValues(t, seOut.custom.iFlowServiceEndpoint, "https://demo.cfapps.sap.hana.ondemand.com/http/testwithcert")
if assert.NoError(t, err) {
t.Run("check url", func(t *testing.T) {
assert.Equal(t, "https://demo/api/v1/ServiceEndpoints?$expand=EntryPoints", httpClient.URL)
})
t.Run("check method", func(t *testing.T) {
assert.Equal(t, "GET", httpClient.Method)
})
}
})
t.Run("Failed Test of Get Integration Flow MPL Status", func(t *testing.T) {
config := integrationArtifactGetServiceEndpointOptions{
Host: "https://demo",
OAuthTokenProviderURL: "https://demo/oauth/token",
Username: "demouser",
Password: "******",
IntegrationFlowID: "CPI_IFlow_Call_using_Cert",
Platform: "cf",
}
httpClient := httpMockCpis{CPIFunction: "IntegrationArtifactGetServiceEndpoint", ResponseBody: ``, TestType: "Negative"}
seOut := integrationArtifactGetServiceEndpointCommonPipelineEnvironment{}
err := runIntegrationArtifactGetServiceEndpoint(&config, nil, &httpClient, &seOut)
assert.EqualValues(t, seOut.custom.iFlowServiceEndpoint, "")
assert.EqualError(t, err, "HTTP GET request to https://demo/api/v1/ServiceEndpoints?$expand=EntryPoints failed with error: Unable to get integration flow service endpoint, Response Status code:400")
})
}

View File

@ -45,6 +45,7 @@ func GetAllStepMetadata() map[string]config.StepData {
"hadolintExecute": hadolintExecuteMetadata(),
"integrationArtifactDeploy": integrationArtifactDeployMetadata(),
"integrationArtifactGetMplStatus": integrationArtifactGetMplStatusMetadata(),
"integrationArtifactGetServiceEndpoint": integrationArtifactGetServiceEndpointMetadata(),
"integrationArtifactUpdateConfiguration": integrationArtifactUpdateConfigurationMetadata(),
"jsonApplyPatch": jsonApplyPatchMetadata(),
"kanikoExecute": kanikoExecuteMetadata(),

View File

@ -0,0 +1,32 @@
# ${docGenStepName}
## ${docGenDescription}
## Prerequisites
## ${docGenParameters}
## ${docGenConfiguration}
## ${docJenkinsPluginDependencies}
## Example
Example configuration for the use in a `Jenkinsfile`.
```groovy
integrationArtifactGetServiceEndpoint script: this
```
Example for the use in a YAML configuration file (such as `.pipeline/config.yaml`).
```yaml
steps:
<...>
integrationArtifactGetServiceEndpoint:
cpiCredentialsId: 'MY_CPI_OAUTH_CREDENTIALSID_IN_JENKINS'
integrationFlowId: 'MY_INTEGRATION_FLOW_ID'
platform: cf
host: https://CPI_HOST_ITSPACES_URL
oAuthTokenProviderUrl: https://CPI_HOST_OAUTH_URL
```

View File

@ -102,6 +102,7 @@ nav:
- influxWriteData: steps/influxWriteData.md
- integrationArtifactDeploy: steps/integrationArtifactDeploy.md
- integrationArtifactGetMplStatus: steps/integrationArtifactGetMplStatus.md
- integrationArtifactGetServiceEndpoint: steps/integrationArtifactGetServiceEndpoint.md
- integrationArtifactUpdateConfiguration: steps/integrationArtifactUpdateConfiguration.md
- jenkinsMaterializeLog: steps/jenkinsMaterializeLog.md
- kanikoExecute: steps/kanikoExecute.md

View File

@ -48,6 +48,8 @@ func GetCPIFunctionMockResponse(functionName, testType string) (*http.Response,
return &res, errors.New("Not found - either wrong version for the given Id or wrong parameter key")
case "IntegrationArtifactGetMplStatus":
return GetIntegrationArtifactGetMplStatusCommandMockResponse(testType)
case "IntegrationArtifactGetServiceEndpoint":
return GetIntegrationArtifactGetServiceEndpointCommandMockResponse(testType)
default:
res := http.Response{
StatusCode: 404,
@ -127,3 +129,60 @@ func GetIntegrationArtifactGetMplStatusCommandMockResponse(testType string) (*ht
}
return &res, errors.New("Unable to get integration flow MPL status, Response Status code:400")
}
//GetIntegrationArtifactGetServiceEndpointCommandMockResponse -Provide http respose body
func GetIntegrationArtifactGetServiceEndpointCommandMockResponse(testCaseType string) (*http.Response, error) {
if testCaseType == "PositiveAndGetetIntegrationArtifactGetServiceResBody" {
return GetIntegrationArtifactGetServiceEndpointPositiveCaseRespBody()
}
res := http.Response{
StatusCode: 400,
Body: ioutil.NopCloser(bytes.NewReader([]byte(`{
"code": "Bad Request",
"message": {
"@lang": "en",
"#text": "invalid service endpoint query"
}
}`))),
}
return &res, errors.New("Unable to get integration flow service endpoint, Response Status code:400")
}
//GetIntegrationArtifactGetServiceEndpointPositiveCaseRespBody -Provide http respose body for positive case
func GetIntegrationArtifactGetServiceEndpointPositiveCaseRespBody() (*http.Response, error) {
resp := http.Response{
StatusCode: 200,
Body: ioutil.NopCloser(bytes.NewReader([]byte(`{
"d": {
"results": [
{
"__metadata": {
"id": "https://demo.cfapps.sap.hana.ondemand.com:443/api/v1/ServiceEndpoints('CPI_IFlow_Call_using_Cert%24endpointAddress%3Dtestwithcert')",
"uri": "https://demo.cfapps.sap.hana.ondemand.com:443/api/v1/ServiceEndpoints('CPI_IFlow_Call_using_Cert%24endpointAddress%3Dtestwithcert')",
"type": "com.sap.hci.api.ServiceEndpoint"
},
"Name": "CPI_IFlow_Call_using_Cert",
"Id": "CPI_IFlow_Call_using_Cert$endpointAddress=testwithcert",
"EntryPoints": {
"results": [
{
"__metadata": {
"id": "https://demo.cfapps.sap.hana.ondemand.com:443/api/v1/EntryPoints('https%3A%2F%2Froverpoc.it-accd002-rt.cfapps.sap.hana.ondemand.com%2Fhttp%2Ftestwithcert')",
"uri": "https://demo.cfapps.sap.hana.ondemand.com:443/api/v1/EntryPoints('https%3A%2F%2Froverpoc.it-accd002-rt.cfapps.sap.hana.ondemand.com%2Fhttp%2Ftestwithcert')",
"type": "com.sap.hci.api.EntryPoint"
},
"Name": "CPI_IFlow_Call_using_Cert",
"Url": "https://demo.cfapps.sap.hana.ondemand.com/http/testwithcert",
"Type": "PROD",
"AdditionalInformation": ""
}
]
}
}
]
}
}`))),
}
return &resp, nil
}

View File

@ -0,0 +1,77 @@
metadata:
name: integrationArtifactGetServiceEndpoint
description: Get an deployed CPI intgeration flow service endpoint
longDescription: |
With this step you can obtain information about the service endpoints exposed by SAP Cloud Platform Integration on a tenant using OData API.Learn more about the SAP Cloud Integration remote API for getting service endpoint of deployed integration artifact [here](https://help.sap.com/viewer/368c481cd6954bdfa5d0435479fd4eaf/Cloud/en-US/26797fbe259349b387a74a5a8f9785c1.html).
spec:
inputs:
secrets:
- name: cpiCredentialsId
description: Jenkins credentials ID containing username and password for authentication to the SAP Cloud Platform Integration API's
type: jenkins
params:
- name: username
type: string
description: User to authenticate to the SAP Cloud Platform Integration Service
scope:
- PARAMETERS
- STAGES
- STEPS
mandatory: true
secret: true
resourceRef:
- name: cpiCredentialsId
type: secret
param: username
- name: password
type: string
description: Password to authenticate to the SAP Cloud Platform Integration Service
scope:
- PARAMETERS
- STAGES
- STEPS
mandatory: true
secret: true
resourceRef:
- name: cpiCredentialsId
type: secret
param: password
- name: integrationFlowId
type: string
description: Specifies the ID of the Integration Flow artifact
scope:
- PARAMETERS
- STAGES
- STEPS
mandatory: true
- name: platform
type: string
description: Specifies the running platform of the SAP Cloud platform integraion service
scope:
- PARAMETERS
- STAGES
- STEPS
mandatory: false
- name: host
type: string
description: Specifies the protocol and host address, including the port. Please provide in the format `<protocol>://<host>:<port>`. Supported protocols are `http` and `https`.
scope:
- PARAMETERS
- STAGES
- STEPS
mandatory: true
- name: oAuthTokenProviderUrl
type: string
description: Specifies the oAuth Provider protocol and host address, including the port. Please provide in the format `<protocol>://<host>:<port>`. Supported protocols are `http` and `https`.
scope:
- PARAMETERS
- STAGES
- STEPS
mandatory: true
outputs:
resources:
- name: commonPipelineEnvironment
type: piperEnvironment
params:
- name: custom/iFlowServiceEndpoint

View File

@ -175,6 +175,7 @@ public class CommonStepsTest extends BasePiperTest{
'integrationArtifactDeploy', //implementing new golang pattern without fields
'integrationArtifactUpdateConfiguration', //implementing new golang pattern without fields
'integrationArtifactGetMplStatus', //implementing new golang pattern without fields
'integrationArtifactGetServiceEndpoint', //implementing new golang pattern without fields
]
@Test

View File

@ -0,0 +1,11 @@
import groovy.transform.Field
@Field String STEP_NAME = getClass().getName()
@Field String METADATA_FILE = 'metadata/integrationArtifactGetServiceEndpoint.yaml'
void call(Map parameters = [:]) {
List credentials = [
[type: 'usernamePassword', id: 'cpiCredentialsId', env: ['PIPER_username', 'PIPER_password']]
]
piperExecuteBin(parameters, STEP_NAME, METADATA_FILE, credentials)
}