Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Campaign Successfully Created without a Container when using REST API #649

Open
davidpet86 opened this issue Feb 19, 2025 · 0 comments
Open

Comments

@davidpet86
Copy link

When using the REST API, a campaign can be created referencing a root resource that does not exist.

Example REST Call using VS Code RESTClient Extension:

REQUEST:

@name CreateCampaign

POST http://{{hostname}}:{{port}}/v1alpha2/campaigns/{{containerName}}-v-v1
Authorization: Bearer {{GetToken.response.body.accessToken}}
Content-Type: application/json

{
"metadata": {
"name": "{{containerName}}-v-v1"
},
"spec": {
"rootResource": "{{containerName}}",
"firstStage": "mock",
"stages": {
"mock": {
"name": "mock",
"provider": "providers.stage.mock",
"inputs": {
"foo": "${{$output(mock,foo)}}"
}
}
}
}
}

RESPONSE:

HTTP/1.1 200 OK
Server: fasthttp
Date: Wed, 19 Feb 2025 14:54:42 GMT
Content-Length: 0
Access-Control-Allow-Credentials: true
Access-Control-Allow-Headers: authorization,Content-Type
Access-Control-Allow-Methods: HEAD,GET,POST,PUT,DELETE,OPTIONS
Access-Control-Allow-Origin: *
Connection: close

When I call the GET campaigns API, it returns the campaign:

REQUEST:

@name List Campaigns

GET http://{{hostname}}:{{port}}/v1alpha2/campaigns
Authorization: Bearer {{GetToken.response.body.accessToken}}

RESPONSE:

HTTP/1.1 200 OK
Server: fasthttp
Date: Wed, 19 Feb 2025 14:55:22 GMT
Content-Type: application/json
Content-Length: 281
Access-Control-Allow-Credentials: true
Access-Control-Allow-Headers: authorization,Content-Type
Access-Control-Allow-Methods: HEAD,GET,POST,PUT,DELETE,OPTIONS
Access-Control-Allow-Origin: *
Connection: close

[
{
"metadata": {
"namespace": "default",
"name": "TestContainer1-v-v1",
"labels": {
"rootResource": "TestContainer1"
}
},
"spec": {
"firstStage": "mock",
"stages": {
"mock": {
"name": "mock",
"provider": "providers.stage.mock",
"inputs": {
"foo": "${{$output(mock,foo)}}"
}
}
},
"rootResource": "TestContainer1"
}
}
]

However when I call thet GET Campaign Containers API, it returns an empty array:

REQUEST:

GET http://{{hostname}}:{{port}}/v1alpha2/campaigncontainers
Authorization: Bearer {{GetToken.response.body.accessToken}}

RESPONSE:

HTTP/1.1 200 OK
Server: fasthttp
Date: Wed, 19 Feb 2025 14:56:16 GMT
Content-Type: application/json
Content-Length: 2
Access-Control-Allow-Credentials: true
Access-Control-Allow-Headers: authorization,Content-Type
Access-Control-Allow-Methods: HEAD,GET,POST,PUT,DELETE,OPTIONS
Access-Control-Allow-Origin: *
Connection: close

[]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant