harness / backstage-plugins

Backstage Plugins for Harness Modules
Other
27 stars 18 forks source link

[Bug]: Integration with backstage isn't reflecting/displaying in backstage application #104

Open anuj-ltim opened 6 months ago

anuj-ltim commented 6 months ago

Expected Behavior

CI/CD tab should render harness pipeline details.

Actual behavior

CI/CD tab isn't reflecting any harness pipeline details and still asking to add relevant annotations.

Context

We followed all the steps mentioned in readme to integrate the harness CI/CD into Backstage but it's not reflecting in Backstage i.e. we don't see the pipeline details in the component's CI/CD tab when we launch Backstage application. We don't see any errors in console and we have used harness cloud platform with free license.

Environment details

Our current backstage versions:

Node: v18.18.0
Yarn: v1.22.19
@backstage/catalog-client @ ^1.4.6 bumped from 1.4.6 to 1.5.0
@backstage/core-components @ ^0.13.8 bumped from 0.13.8 to 0.13.9
@backstage/core-plugin-api @ ^1.8.0 bumped from 1.8.0 to 1.8.1
@backstage/integration-react @ ^1.1.21 bumped from 1.1.21 to 1.1.22
@backstage/integration @ ^1.7.2 bumped from 1.7.2 to 1.8.0
@backstage/plugin-catalog-common @ ^1.0.18 bumped from 1.0.18 to 1.0.19
@backstage/plugin-catalog-react @ ^1.9.1 bumped from 1.9.1 to 1.9.2
@backstage/plugin-permission-common @ ^0.7.10 bumped from 0.7.10 to 0.7.11
@backstage/plugin-permission-react @ ^0.4.17 bumped from 0.4.17 to 0.4.18
@backstage/plugin-search-common @ ^1.2.8 bumped from 1.2.8 to 1.2.9
@backstage/core-components @ ^0.11.1 should be changed to ^0.13.9
@backstage/frontend-plugin-api @ ^0.3.0 should be changed to ^0.4.0
@backstage/theme @ ^0.2.16 should be changed to ^0.5.0
@backstage/theme @ ^0.4.4 should be changed to ^0.5.0
OrkoHunter commented 6 months ago

and still asking to add relevant annotations.

Hi Anuj, can you please share the catalog-info.yaml file for the catalog entity you are viewing? I wonder what annotations you have added.

cc @vigneswara-propelo

rakeshkumarltim commented 6 months ago

and still asking to add relevant annotations.

Hi Anuj, can you please share the catalog-info.yaml file for the catalog entity you are viewing? I wonder what annotations you have added.

cc @vigneswara-propelo

We tried both old and new annotations with two components. Sharing the catalog-info.yaml for both the components.

apiVersion: backstage.io/v1alpha1 kind: Component metadata: name: "backstage-test-rakesh1" sonarqube.org/project-key: backstage-test-rakesh1 jira/project-key: backstage-test-rakesh1 'backstage.io/kubernetes-namespace': backstage-test-rakesh1 'backstage.io/kubernetes-id': backstage-test-rakesh1 harness.io/pipelines: | Pipeline1: https://app.harness.io/ng/account/XXXXXXXXXX/home/orgs/default/projects/default_project/pipelines/testcreatedpipe/pipeline-studio/?storeType=INLINE Pipeline2: https://app.harness.io/ng/account/XXXXXXXXXX/home/orgs/default/projects/default_project/pipelines/Deploy_Pipleine/pipeline-studio/?storeType=INLINE harness.io/services: | Service1: https://app.harness.io/ng/account/XXXXXXXXXX/home/orgs/default/projects/default_project/services/demoservice?tab=configuration Service2: https://app.harness.io/ng/account/XXXXXXXXXX/home/orgs/default/projects/default_project/services/K8DeployService?tab=configuration spec: type: service owner: user:guest lifecycle: experimental


apiVersion: backstage.io/v1alpha1 kind: Component metadata: name: "backstage-test-rakesh3" sonarqube.org/project-key: backstage-test-rakesh3 jira/project-key: backstage-test-rakesh3 'backstage.io/kubernetes-namespace': backstage-test-rakesh3 'backstage.io/kubernetes-id': backstage-test-rakesh3 harness.io/project-url: https://app.harness.io/ng/account/XXXXXXXXXX/home/orgs/default/projects/default_project/details spec: type: service owner: user:guest lifecycle: experimental

OrkoHunter commented 6 months ago

@rakeshkumarltim You seem to have added the annotations under the metadata field. They should be under metadata.annotations. See an example

https://github.com/harness/backstage-plugins/blob/main/examples/catalog-harness-cicd-new.yaml

rakeshkumarltim commented 6 months ago

@rakeshkumarltim You seem to have added the annotations under the metadata field. They should be under metadata.annotations. See an example

https://github.com/harness/backstage-plugins/blob/main/examples/catalog-harness-cicd-new.yaml

Thank you OrkoHunter. I have updated the my catalog-info.yaml and now I could see the dropdown in my CI/CD tab. But execution details are not listed, instead getting a message "Could not find the pipeline executions, please check your configurations in catalog-info.yaml or check your permissions.". Can you help me to fix this? From the log: /api/proxy/harness/prod/gateway/pipeline/api/pipelines/execution/v2/summary?accountIdentifier=XXXXXXX&orgIdentifier=default&projectIdentifier=default_project&size=5&page=0&pipelineIdentifier=YYYYY&pipelineIdentifier=Deploy_Pipleine HTTP/1.1" 404 146 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:120.0) Gecko/20100101 Firefox/120.0" type=incomingRequest

apiVersion: backstage.io/v1alpha1 kind: Component metadata: name: "backstage-test-rakesh1" sonarqube.org/project-key: backstage-test-rakesh1 jira/project-key: backstage-test-rakesh1 'backstage.io/kubernetes-namespace': backstage-test-rakesh1 'backstage.io/kubernetes-id': backstage-test-rakesh1 annotations: harness.io/pipelines: | Pipeline1: https://app.harness.io/ng/account/XXXXXXXXX/home/orgs/default/projects/default_project/pipelines/testcreatedpipe/pipeline-studio/?storeType=INLINE Pipeline2: https://app.harness.io/ng/account/XXXXXXXXX/home/orgs/default/projects/default_project/pipelines/Deploy_Pipleine/pipeline-studio/?storeType=INLINE harness.io/services: | Service1: https://app.harness.io/ng/account/XXXXXXXXX/home/orgs/default/projects/default_project/services/demoservice Service2: https://app.harness.io/ng/account/XXXXXXXXX/home/orgs/default/projects/default_project/services/K8DeployService spec: type: service owner: user:guest lifecycle: experimental

vigneswara-propelo commented 6 months ago

@rakeshkumarltim - The log you have attached says there are two different pipelineIdentifier. Ideally, there should be only one pipelineIdentifier. Could you check the log once?/api/proxy/harness/prod/gateway/pipeline/api/pipelines/execution/v2/summary?accountIdentifier=XXXXXXX&orgIdentifier=default&projectIdentifier=default_project&size=5&page=0&pipelineIdentifier=YYYYY&pipelineIdentifier=Deploy_Pipleine

Did CI/CD work for the other component with old annotation?

vigneswara-propelo commented 6 months ago

@rakeshkumarltim - We can also check if the generated X-Api-key has necessary permission to view pipeline executions. Please provide values for these placeholders - {ACCOUNT_ID}, {PIPELINE_ID}, {X-API-Key} and run below curl

curl --location 'https://app.harness.io/gateway/pipeline/api/pipelines/execution/v2/summary?accountIdentifier={ACCOUNT_ID}&routingId={ACCOUNT_ID}&projectIdentifier=default_project&orgIdentifier=default&page=0&size=5&pipelineIdentifier={PIPELINE_ID}' \ --header 'content-type: application/json' \ --header 'x-api-key: {X-API-Key}' \ --data 'null'

rakeshkumarltim commented 6 months ago

@vigneswara-propelo : Output of the curl command is ,

"status":"ERROR","code":"INVALID_TOKEN","message":"Token is not valid.","correlationId":null,"detailedMessage":null,"responseMessages":[{"code":"INVALID_TOKEN","level":"ERROR","message":"Token is not valid.","exception":null,"failureTypes":[]}],"metadata":null}--header: command not found

Tried to use both pat (pat.xxxx.xxxx) & sat (sat.xxxx.xxxx) token and result is same. And the token is valid still

vigneswara-propelo commented 6 months ago

I guess you are trying this curl in your terminal and not in postman. If you don't have postman, please use below curl command to work properly in your terminal

curl --location 'https://app.harness.io/gateway/pipeline/api/pipelines/execution/v2/summary?accountIdentifier={ACCOUNT_ID}&routingId={ACCOUNT_ID}&projectIdentifier=default_project&orgIdentifier=default&page=0&size=5&pipelineIdentifier={PIPELINE_ID}' --header 'content-type: application/json' --header 'x-api-key: {X-API-Key}' --data 'null'

anuj-ltim commented 6 months ago

@vigneswara- thanks for your suggestion, tried and following is a brief snapshot of the output, please let us know if you need any other info -

{"status":"SUCCESS","data":{"content":[{"pipelineIdentifier":"Deploy_Pipleine","orgIdentifier":"default","projectIdentifier":"default_project","planExecutionId":"xjp2oYH-TYCk4bbX9U-RIg","name":"Deploy Pipleine","yamlVersion":"0","status":"Success","tags":[],"executionTriggerInfo":{
  "triggerType": "MANUAL",
  "triggeredBy": {
    "uuid": "EM9Nf6dmQxyz5xcMwqT04w",
    "identifier": "rakeshkumar.10675353",
    "extraInfo": {
      "email": "rakeshkumar.10675353@ltimindtree.com"
    },
    "triggerIdentifier": "",
    "triggerName": ""
  },
  "isRerun": false
},"governanceMetadata":{
  "id": "",
  "deny": false,
  "details": [],
  "message": "",
  "timestamp": "0",
  "status": "",
  "accountId": "",
  "orgId": "",
  "projectId": "",
  "entity": "",
  "type": "",
  "action": "",
  "created": "0"
},"moduleInfo":{"cd":{"__recast":"io.harness.cdng.pipeline.executions.beans.CDPipelineModuleInfo","artifactDisplayNames":["13","rakesh635/java-spring-petclinic-rakesh635","rakesh635/java-spring-petclinic-rakesh635:13","index.docker.io/rakesh635/java-spring-petclinic-rakesh635:13"],"envGroupIdentifiers":[],"envIdentifiers":["newDev"],"environmentTypes":["PreProduction"],"freezeIdentifiers":[],"gitOpsAppIdentifiers":[],"infrastructureIdentifiers":["newDevInfra"],"infrastructureNames":["newDevInfra"],"infrastructureTypes":["KubernetesDirect"],"serviceDefinitionTypes":["Kubernetes"],"serviceIdentifiers":["K8DeployService"]}},"layoutNodeMap":{"jwBAaB8WQOSro18U5z8yHw":{"nodeType":"Deployment","nodeGroup":"STAGE","nodeIdentifier":"Deploy_Stage","name":"Deploy Stage","nodeUuid":"jwBAaB8WQOSro18U5z8yHw","status":"Success","module":"cd","moduleInfo":{"cd":{"__recast":"io.harness.cdng.pipeline.executions.beans.CDStageModuleInfo","rollbackDuration":0,"serviceInfo":{"__recast":"io.harness.cdng.pipeline.executions.beans.ServiceExecutionSummary","identifier":"K8DeployService","displayName":"K8DeployService","deploymentType":"Kubernetes","gitOpsEnabled":false,"artifacts":{"__recast":"io.harness.cdng.pipeline.executions.beans.ServiceExecutionSummary$ArtifactsSummary","primary":{"__recast":"io.harness.ngpipeline.pipeline.executions.beans.DockerArtifactSummary","imagePath":"rakesh635/java-spring-petclinic-rakesh635","tag":"13","artifactIdentity":{"__recast":"io.harness.cdng.artifact.bean.ArtifactCorrelationDetails","image":"index.docker.io/rakesh635/java-spring-petclinic-rakesh635:13"}},"artifactDisplayName":"rakesh635/java-spring-petclinic-rakesh635:13","sidecars":[]},"manifestInfo":{"__recast":"io.harness.cdng.manifest.yaml.summary.ManifestStoreInfo","branch":"master","repoName":"java-spring-petclinic","paths":["kube/kubernetesmanifest.yaml"]}},"infraExecutionSummary":{"__recast":"io.harness.cdng.pipeline.executions.beans.InfraExecutionSummary","identifier":"newDev","name":"newDev","type":"PreProduction","infrastructureIdentifier":"newDevInfra","infrastructureName":"newDevInfra"}}},"startTs":1702621886697,"endTs":1702621933061,"edgeLayoutList":{"currentNodeChildren":[],"nextIds":[]},"nodeRunInfo":{
  "whenCondition": "\u003c+OnPipelineSuccess\u003e",
  "evaluatedCondition": true,
  "expressions": [{
    "expression": "OnPipelineSuccess",
    "expressionValue": "true",
    "count": 1
  }]
},"failureInfo":{
  "message": ""
},"failureInfoDTO":{"message":"","failureTypeList":[],"responseMessages":[]},"nodeExecutionId":"LW0A-jdzT6KrVLwjP2Kb6g","executionInputConfigured":false,"isRollbackStageNode":false},"0eMYbAnzRciWH9Rj36MSUQ":{"nodeType":"PipelineRollback","nodeGroup":"STAGE","nodeIdentifier":"prb-1frrOQzpQdWZ3a8CXTcy2w","name":"Pipeline Rollback","nodeUuid":"0eMYbAnzRciWH9Rj36MSUQ","status":"NotStarted","module":"pms","moduleInfo":{"pms":{}},"edgeLayoutList":{"currentNodeChildren":[],"nextIds":[]},"isRollbackStageNode":false}},"modules":["cd","pms"],"startingNodeId":"jwBAaB8WQOSro18U5z8yHw","startTs":1702621886446,"endTs":1702621933192,"createdAt":1702621886497,"canRetry":true,"showRetryHistory":false,"runSequence":13,"successfulStagesCount":1,"runningStagesCount":0,"failedStagesCount":0,"totalStagesCount":1,"storeType":"INLINE","executionInputConfigured":false,"parentStageInfo":{"hasparentpipeline":false,"stagenodeid":"","executionid":"","identifier":"","projectid":"","orgid":"","runsequence":0},"allowStageExecutions":false,"executionMode":"NORMAL","notesExistForPlanExecutionId":false,"shouldUseSimplifiedKey":false,"stagesExecution":false},{"pipelineIdentifier":"Deploy_Pipleine","orgIdentifier":"default","projectIdentifier":"default_project","planExecutionId":"-eGTpwChS1iGa9gKvgvoJQ","name":"Deploy Pipleine","yamlVersion":"0","status":"Failed","tags":[],"executionTriggerInfo":{
  "triggerType": "MANUAL",
  "triggeredBy": {
    "uuid": "EM9Nf6dmQxyz5xcMwqT04w",
    "identifier": "rakeshkumar.10675353",
    "extraInfo": {
      "email": "rakeshkumar.10675353@ltimindtree.com"
    },
    "triggerIdentifier": "",
    "triggerName": ""
  },
  "isRerun": false
},"executionErrorInfo":{
  "message": "Kubernetes API call failed with message: Forbidden"
},"governanceMetadata":{
  "id": "",
  "deny": false,
  "details": [],
  "message": "",
  "timestamp": "0",
  "status": "",
  "accountId": "",
  "orgId": "",
  "projectId": "",
  "entity": "",
  "type": "",
  "action": "",
  "created": "0"
},"moduleInfo":{"cd":{"__recast":"io.harness.cdng.pipeline.executions.beans.CDPipelineModuleInfo","artifactDisplayNames":["13","rakesh635/java-spring-petclinic-rakesh635","rakesh635/java-spring-petclinic-rakesh635:13","index.docker.io/rakesh635/java-spring-petclinic-rakesh635:13"],"envGroupIdentifiers":[],"envIdentifiers":["Dev"],"environmentTypes":["PreProduction"],"freezeIdentifiers":[],"gitOpsAppIdentifiers":[],"infrastructureIdentifiers":["AWS_EKS_Infra"],"infrastructureNames":["AWS EKS Infra"],"infrastructureTypes":["KubernetesAws"],"serviceDefinitionTypes":["Kubernetes"],"serviceIdentifiers":["K8DeployService"]}},"layoutNodeMap":{"reOhkVYbQJmXDN1qGbqwPQ":{"nodeType":"PipelineRollback","nodeGroup":"STAGE","nodeIdentifier":"prb-rXbZbYleSoObM9pVfW1zxw","name":"Pipeline Rollback","nodeUuid":"reOhkVYbQJmXDN1qGbqwPQ","status":"NotStarted","module":"pms","moduleInfo":{"pms":{}},"edgeLayoutList":{"currentNodeChildren":[],"nextIds":[]},"isRollbackStageNode":false},"99_106c_Tg2hyBe3TzEVIA":{"nodeType":"Deployment","nodeGroup":"STAGE","nodeIdentifier":"Deploy_Stage","name":"Deploy Stage","nodeUuid":"99_106c_Tg2hyBe3TzEVIA","status":"Failed","module":"cd","moduleInfo":{"cd":{"__recast":"io.harness.cdng.pipeline.executions.beans.CDStageModuleInfo","rollbackDuration":3856,"serviceInfo":{"__recast":"io.harness.cdng.pipeline.executions.beans.ServiceExecutionSummary","identifier":"K8DeployService","displayName":"K8DeployService","deploymentType":"Kubernetes","gitOpsEnabled":false,"artifacts":{"__recast":"io.harness.cdng.pipeline.executions.beans.ServiceExecutionSummary$ArtifactsSummary","primary":{"__recast":"io.harness.ngpipeline.pipeline.executions.beans.DockerArtifactSummary","imagePath":"rakesh635/java-spring-petclinic-rakesh635","tag":"13","artifactIdentity":{"__recast":"io.harness.cdng.artifact.bean.ArtifactCorrelationDetails","image":"index.docker.io/rakesh635/java-spring-petclinic-rakesh635:13"}},"artifactDisplayName":"rakesh635/java-spring-petclinic-rakesh635:13","sidecars":[]},"manifestInfo":{"__recast":"io.harness.cdng.manifest.yaml.summary.ManifestStoreInfo","branch":"master","repoName":"java-spring-petclinic","paths":["kube/kubernetesmanifest.yaml"]}},"infraExecutionSummary":{"__recast":"io.harness.cdng.pipeline.executions.beans.InfraExecutionSummary","identifier":"Dev","name":"Dev","type":"PreProduction","infrastructureIdentifier":"AWS_EKS_Infra","infrastructureName":"AWS EKS Infra"}}},"startTs":1702466547492,"endTs":1702466564430,"edgeLayoutList":{"currentNodeChildren":[],"nextIds":[]},"nodeRunInfo":{
  "whenCondition": "\u003c+OnPipelineSuccess\u003e",
  "evaluatedCondition": true,
  "expressions": [{
    "expression": "OnPipelineSuccess",
    "expressionValue": "true",
    "count": 1
  }]
}
jenil-harness commented 6 months ago

@anuj-ltim Can you share the proxy config you have defined in app-config.yaml?

anuj-ltim commented 6 months ago

@jenil-harness kindly refer below -

proxy:
  endpoints:
    '/jira/api':
      target: 'https://ltim.atlassian.net'
      headers:
        Authorization:
          Development: ${JIRA_TOKEN_DEV}
          Production: ${JIRA_TOKEN_PROD}
        Accept: 'application/json'
        Content-Type: 'application/json'
        X-Atlassian-Token: 'nocheck'
        User-Agent: "MY-UA-STRING"

    '/harness':
      target: 'https://app.harness.io/'
      headers:
        'x-api-key': pat.xxx.xxx
jenil-harness commented 6 months ago

@anuj-ltim Config should be

    'harness/prod':
         target: 'https://app.harness.io/'
         headers:
             'x-api-key': pat.xxx.xxx

ref - https://github.com/harness/backstage-plugins/blob/cd70f9c03ed52917d8f409c2ceb7b7fc874c97de/app-config.yaml#L50C2-L53C64

anuj-ltim commented 6 months ago

@jenil-harness thanks for the suggestion. I did update like you suggested, don't see any errors in console but still pipeline isn't displayed. Thanks for trying to help us out, truly appreciate it.

'harness/prod':
      target: 'https://app.harness.io/'
      headers:
        'x-api-key': pat.xxx.xxx
yarn run v1.22.19
$ concurrently "yarn start" "yarn start-backend"
$ yarn workspace backend start
$ yarn workspace app start
$ backstage-cli package start
$ backstage-cli package start
[0] Loaded config from app-config.yaml, app-config.local.yaml
[0] <i> [webpack-dev-server] Project is running at:
[0] <i> [webpack-dev-server] Loopback: http://localhost:3000/, http://127.0.0.1:3000/
[0] <i> [webpack-dev-server] Content not from webpack is served from '/home/anuj/backstage-harness/packages/app/public' directory
[0] <i> [webpack-dev-server] 404s will fallback to '/index.html'
[0] <i> [webpack-dev-middleware] wait until bundle finished: /
[1] Loaded config from app-config.yaml, app-config.local.yaml
[1] 2024-01-03T09:01:05.914Z backstage info Found 7 new secrets in config that will be redacted 
[1] 2024-01-03T09:01:05.931Z backstage info Created UrlReader predicateMux{readers=azure{host=dev.azure.com,authed=false},bitbucketCloud{host=bitbucket.org,authed=false},github{host=github.com,authed=false},gitlab{host=gitlab.example.com,authed=true},gitlab{host=gitlab.com,authed=false},awsS3{host=amazonaws.com,authed=false},fetch{} 
[1] 2024-01-03T09:01:06.193Z catalog info Performing database migration type=plugin
[1] 2024-01-03T09:01:07.352Z auth info Configuring "database" as KeyStore provider type=plugin
[1] 2024-01-03T09:01:07.497Z auth info Configuring auth provider: gitlab type=plugin
[1] 2024-01-03T09:01:07.503Z techdocs info Creating Local publisher for TechDocs type=plugin
[1] 2024-01-03T09:01:07.509Z proxy info [HPM] Proxy created: /jira/api  -> https://ltim.atlassian.net type=plugin
[1] 2024-01-03T09:01:07.510Z proxy info [HPM] Proxy rewrite rule created: "^/api/proxy/jira/api/?" ~> "/" type=plugin
[1] 2024-01-03T09:01:07.514Z proxy info [HPM] Proxy created: harness/prod  -> https://app.harness.io/ type=plugin
[1] 2024-01-03T09:01:07.514Z proxy info [HPM] Proxy rewrite rule created: "^/api/proxy/harness/prod/?" ~> "/" type=plugin
[1] 2024-01-03T09:01:07.515Z proxy info [HPM] Proxy created: /harness  -> https://app.harness.io/ type=plugin
[1] 2024-01-03T09:01:07.515Z proxy info [HPM] Proxy rewrite rule created: "^/api/proxy/harness/?" ~> "/" type=plugin
[1] 2024-01-03T09:01:07.517Z search info Added DefaultCatalogCollatorFactory collator factory for type software-catalog type=plugin
[1] 2024-01-03T09:01:07.517Z search info Added DefaultTechDocsCollatorFactory collator factory for type techdocs type=plugin
[1] 2024-01-03T09:01:07.518Z search info Starting all scheduled search tasks. type=plugin
[1] 2024-01-03T09:01:07.776Z app info Serving static app content from /home/anuj/backstage-harness/packages/app/dist type=plugin
[1] 2024-01-03T09:01:07.804Z backstage info Task worker starting: search_index_software_catalog, {"version":2,"cadence":"PT10M","initialDelayDuration":"PT3S","timeoutAfterDuration":"PT15M"} type=taskManager task=search_index_software_catalog
[1] 2024-01-03T09:01:07.805Z backstage info Task worker starting: search_index_techdocs, {"version":2,"cadence":"PT10M","initialDelayDuration":"PT3S","timeoutAfterDuration":"PT15M"} type=taskManager task=search_index_techdocs
[1] 2024-01-03T09:01:08.979Z app info Replacing injected env config in module-backstage.a5be3b30.js type=plugin
[1] 2024-01-03T09:01:09.059Z app info Storing 0 updated assets and 319 new assets type=plugin
[0] webpack compiled successfully
[1] 2024-01-03T09:03:26.361Z backstage info ::ffff:127.0.0.1 - - [03/Jan/2024:09:03:26 +0000] "GET /api/proxy/harness/prod/gateway/ng/api/licenses/account?routingId=Pw6qxF-VRFCe9FtTxpNgOA&accountIdentifier=Pw6qxF-VRFCe9FtTxpNgOA HTTP/1.1" 404 146 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:120.0) Gecko/20100101 Firefox/120.0" type=incomingRequest
[1] 2024-01-03T09:03:26.362Z backstage info ::ffff:127.0.0.1 - - [03/Jan/2024:09:03:26 +0000] "POST /api/proxy/harness/prod/gateway/pipeline/api/pipelines/execution/v2/summary?accountIdentifier=Pw6qxF-VRFCe9FtTxpNgOA&routingId=Pw6qxF-VRFCe9FtTxpNgOA&orgIdentifier=default&projectIdentifier=default_project&size=5&page=0 HTTP/1.1" 404 146 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:120.0) Gecko/20100101 Firefox/120.0" type=incomingRequest
[1] 2024-01-03T09:03:26.367Z backstage info ::ffff:127.0.0.1 - - [03/Jan/2024:09:03:26 +0000] "POST /api/proxy/harness/prod/gateway/pipeline/api/pipelines/execution/v2/summary?accountIdentifier=Pw6qxF-VRFCe9FtTxpNgOA&routingId=Pw6qxF-VRFCe9FtTxpNgOA&orgIdentifier=default&projectIdentifier=default_project&size=5&page=0 HTTP/1.1" 404 146 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:120.0) Gecko/20100101 Firefox/120.0" type=incomingRequest
[1] 2024-01-03T09:03:32.281Z backstage info ::ffff:127.0.0.1 - - [03/Jan/2024:09:03:32 +0000] "POST /api/proxy/harness/prod/gateway/pipeline/api/pipelines/execution/v2/summary?accountIdentifier=Pw6qxF-VRFCe9FtTxpNgOA&routingId=Pw6qxF-VRFCe9FtTxpNgOA&orgIdentifier=default&projectIdentifier=default_project&size=5&page=0&pipelineIdentifier=testcreatedpipe HTTP/1.1" 404 146 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:120.0) Gecko/20100101 Firefox/120.0" type=incomingRequest
[1] 2024-01-03T09:03:55.612Z catalog warn Detected conflicting entityRef component:default/ltim-backstage-app already referenced by url:https://gitlab.example.com/digital-engg-lab/backstage/backstage-harness/-/blob/main/catalog-info.yaml and now also url:https://gitlab.example.com/digital-engg-lab/backstage/ltim-backstage-app/-/blob/main/catalog-info.yaml type=plugin

image

jenil-harness commented 6 months ago

@anuj-ltim Can you share the response of the network request made from the browser?

Inspect -> Network -> Filter by /harness/prod. Share the URL of the request made and the response.

anuj-ltim commented 6 months ago

@jenil-harness does the below snapshots help or need anything I can help with ?

image

image

image

image

Debanitrkl commented 6 months ago

Hi @anuj-ltim looking at your API calls, it's clear that there's some issue with your annotations in the catalog-info.yaml please try out with this https://github.com/Debanitrkl/backstage-test/blob/main/video-demo.yaml, this works well.

michael-pang commented 2 months ago

We are facing the same issue as well. We are able to produce the dropdown of Service / Pipelines specified in the label but then we get the same error that @rakeshkumarltim described. I have tried different variations of the pipeline URL with no luck.

kind: Component
metadata:
  name: test-harness-plugin
  description: Testing Harness Plugin
  annotations:
    harness.io/pipelines: |
      labelA: https://app.harness.io/ng/account/XXXXXXXXXXX/home/orgs/ORG_EXAMPLE/projects/test_plugin/pipelines/Deploy_Service_to_Cluster/pipeline-studio/?storeType=REMOTE&connectorRef=account.Org_Example&repoName=my-repository-name&branch=main
spec:
  type: test
  lifecycle: experimental
  owner: team
  system: harness-plugin

image

Debanitrkl commented 2 months ago

Hi @michael-pang could you please update the URL to be of this format https://app.harness.io/ng/account/account_id/module/module_id/orgs/org_id/projects/project_id/pipelines If you're a cd user here's an example https://app.harness.io/ng/account/account_id/module/cd/orgs/default/projects/project_id/pipelines

michael-pang commented 2 months ago

@Debanitrkl where do we specify the pipeline ID in these URLs? How does it know what pipeline to populate? Also if that is the case then the images in the documentation are not clear.

Debanitrkl commented 2 months ago

@michael-pang the way this plugins works is it will fetch data for the recent pipeline executions in your project.

Debanitrkl commented 2 months ago

For pipelines, when you're using annotations: harness.io/pipelines: just extend the url to pipeline name which would be something like https://app.harness.io/ng/account/account_id/module/cd/orgs/org_id/projects/project_id/pipelines/pipeline_name/

Debanitrkl commented 2 months ago

Here's the example mentioned in the documentation

michael-pang commented 2 months ago

@Debanitrkl same issue unfortunately. If I leave module in the URL, I get the following error:

Cannot read properties of undefined (reading 'orgId')
TypeError: Cannot read properties of undefined (reading 'orgId')

If I remove module I get the same result as I linked above. I triple checked the orgId as well.

Debanitrkl commented 2 months ago

Please try to with the URL format that I provided here https://github.com/harness/backstage-plugins/issues/104#issuecomment-2050190762: https://app.harness.io/ng/account/account_id/module/cd/orgs/org_id/projects/project_id/pipelines/pipeline_name/ It contains module/module_id.

michael-pang commented 2 months ago

@Debanitrkl I have tried keeping it with module/module_id so in my scenario it would be module/cd and I get the following error I linked above. My orgId is correct as well.

Debanitrkl commented 2 months ago

@Debanitrkl I have tried keeping it with module/module_id so in my scenario it would be module/cd and I get the following error I linked above. My orgId is correct as well.

Could you please share the URL you had used also check the URL you have used doesn't give 404 when tried to access pipelines directly using the URL.

michael-pang commented 2 months ago

Here is the URL with https://app.harness.io/ng/account/abcdefg123456/module/cd/orgs/my_org_name/projects/my_project_name/pipelines/my_pipeline_name/and i'm not getting a 404 either.

I am getting the following error in Backstage: TypeError: Cannot read properties of undefined (reading 'orgId')