keptn-sandbox / keptn-azure-devops-extension

Azure DevOps Extension for integrating Keptn with your Azure DevOps Pipelines
Apache License 2.0
6 stars 4 forks source link

prepareKeptnEnv fails when trying to check whether a project exists #72

Closed christian-kreuzberger-dtx closed 2 years ago

christian-kreuzberger-dtx commented 2 years ago

From Keptn Slack:

Using PrepareKeptnEnv and task version 1.12, prepareKeptnEnv fails:

2022-02-16T05:58:16.0488598Z ##[section]Starting: Prepare Keptn environment
2022-02-16T05:58:16.0496120Z ==============================================================================
2022-02-16T05:58:16.0496503Z Task         : Prepare Keptn environment
2022-02-16T05:58:16.0496848Z Description  : Initialize Keptn environment with project and stage
2022-02-16T05:58:16.0497126Z Version      : 1.12.0
2022-02-16T05:58:16.0497387Z Author       : Realdolmen (Bert Van der Heyden)
2022-02-16T05:58:16.0497725Z Help         : Initialize Keptn environment with project and stage
2022-02-16T05:58:16.0498098Z 
...
2022-02-16T05:58:16.2451611Z using keptnApiEndpoint https://stage-aks.XXXXX.com/api
2022-02-16T05:58:16.2452311Z using project testproject
2022-02-16T05:58:16.2453058Z using service testservice
2022-02-16T05:58:16.2453544Z using stage dev
2022-02-16T05:58:16.3730037Z metadata endpoint exists...
2022-02-16T05:58:16.3733289Z keptnVersion = 0.11.4
2022-02-16T05:58:16.4047780Z { Error: Request failed with status code 405
...
code: 405,
message: 'method GET is not allowed, but [PUT,DELETE] 
...

It seems that it is trying to access /api/configuration-service/v1/project/$PROJECT which does not exist (checked in 0.12.0, it's NOT there).

Here is the relevant code: https://github.com/keptn-sandbox/keptn-azure-devops-extension/blob/2464d7fa4ecbc279ec8aaee9a6946ccbdcf3bc28/PrepareKeptnEnvTask/index.ts#L294-L296

Instead we should use /api/controlPlane/v1/project/$PROJECT

christian-kreuzberger-dtx commented 2 years ago

It seems that an old version of the library is used. This bug was fixed with a recent release, 1.4.1 for sure.