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

Provide environment URL when possible on deployments #2162

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions src/github/client/github-queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,7 @@ export type DeploymentQueryNode = {
createdAt: string,
updatedAt: string,
state: string,
environmentUrl: string,
logUrl: string
}[]
},
Expand Down Expand Up @@ -408,7 +409,7 @@ export const getDeploymentsQuery = `query ($owner: String!, $repo: String!, $per
edges {
cursor
node {
createdAt
createdAt
repository {
id: databaseId
node_id: id
Expand All @@ -431,7 +432,7 @@ export const getDeploymentsQuery = `query ($owner: String!, $repo: String!, $per
logUrl
state
id
createdAt
createdAt
updatedAt
}
}
Expand All @@ -446,7 +447,7 @@ export const getDeploymentsQueryWithStatuses = `query ($owner: String!, $repo: S
edges {
cursor
node {
createdAt
createdAt
repository {
id: databaseId
node_id: id
Expand All @@ -469,15 +470,16 @@ export const getDeploymentsQueryWithStatuses = `query ($owner: String!, $repo: S
createdAt
updatedAt
state
logUrl
logUrl
environmentUrl
aldenquimby marked this conversation as resolved.
Show resolved Hide resolved
}
}
latestStatus {
environmentUrl
logUrl
state
id
createdAt
createdAt
updatedAt
}
}
Expand Down
1 change: 1 addition & 0 deletions src/interfaces/jira.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ export interface JiraDeployment {
id: string;
displayName: string;
type: string;
url?: string;
};
associations: JiraAssociation[];
}
Expand Down
1 change: 1 addition & 0 deletions src/sqs/deployment.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ describe("Deployment Webhook", () => {
"environment": {
"id": "Production",
"displayName": "Production",
"url": "https://test-repo-url.env-production.company.io",
"type": "production"
},
"associations": [
Expand Down
4 changes: 4 additions & 0 deletions src/sync/deployment.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -495,6 +495,7 @@ describe("sync/deployments", () => {
"environment": {
"id": "prod",
"displayName": "prod",
"url": "https://test-repo-url.env-production.company.io",
"type": "production"
},
"associations": [
Expand Down Expand Up @@ -621,6 +622,7 @@ describe("sync/deployments", () => {
environment: {
id: "prod",
displayName: "prod",
url: "https://test-repo-url.env-production.company.io",
type: "production"
},
associations: [
Expand Down Expand Up @@ -660,6 +662,7 @@ describe("sync/deployments", () => {
environment: {
id: "prod",
displayName: "prod",
url: "https://test-repo-url.env-production.company.io",
type: "production"
},
associations: [
Expand Down Expand Up @@ -893,6 +896,7 @@ describe("sync/deployments", () => {
"environment": {
"id": "prod",
"displayName": "prod",
"url": "https://test-repo-url.env-production.company.io",
"type": "production"
},
"associations": [
Expand Down
1 change: 1 addition & 0 deletions src/sync/deployment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ const getTransformedDeployments = async (useDynamoForBackfill: boolean, deployme
environment: deployment.environment,
id: deployment.databaseId,
target_url: logUrl,
environment_url: firstNonInactiveStatus?.environmentUrl || deployment.latestStatus?.environmentUrl,
created_at: firstNonInactiveStatus?.createdAt || deployment.latestStatus?.createdAt,
updated_at: firstNonInactiveStatus?.updatedAt || deployment.latestStatus?.updatedAt,
state: firstNonInactiveStatus?.state?.toLowerCase() || deployment.latestStatus?.state
Expand Down
1 change: 1 addition & 0 deletions src/transforms/transform-deployment.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ const buildJiraPayload = (displayName="testing", associations) => {
environment: {
id: "Production",
displayName: "Production",
url: "https://test-repo-url.env-production.company.io",
type: "production"
},
associations
Expand Down
1 change: 1 addition & 0 deletions src/transforms/transform-deployment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,7 @@ export const transformDeployment = async (
environment: {
id: deployment_status.environment,
displayName: deployment_status.environment,
url: deployment_status.environment_url,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately, according to this public doc https://developer.atlassian.com/cloud/jira/software/rest/api-group-deployments/#api-rest-deployments-0-1-bulk-post
The url is not supported in the payload, and confirmed with internal team, the environment tab is not clickable at the moment.

And this is new to features to the ui team, so they don't have a roadmap on making it clickable so far, no ETA yet.

If you like, can you please submit a feature request to Jira software?

Thanks.

type: environment
},
associations
Expand Down
14 changes: 8 additions & 6 deletions test/fixtures/api/graphql/deployment-nodes-mixed.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
"cursor": "Y3Vyc29yOnYyOpK0MjAyMi0wMi0wM1QyMjo0NTowM1rOHdDZeg==",
"node": {
"repository": {
"id": 24,
"node_id": "pK0MjAyMi0wMi0wM1QyMj",
"id": 24,
"node_id": "pK0MjAyMi0wMi0wM1QyMj",
"name": "test-repo-name",
"owner": {
"login": "test-repo-owner"
Expand All @@ -24,7 +24,7 @@
"environment": "prod",
"description": "",
"latestStatus": {
"environmentUrl": "",
"environmentUrl": "https://test-repo-url.env-production.company.io",
"logUrl": "https://github.com/test-repo-owner/test-repo-name/commit/51e16759cdac67b0d2a94e0674c9603b75a840f6/checks",
"state": "success",
"id": "DES_kwDOGtdD5840PkSo",
Expand All @@ -35,6 +35,7 @@
{
"createdAt": "2022-02-03T22:45:04Z",
"updatedAt": "2022-02-03T22:45:04Z",
"environmentUrl": "https://test-repo-url.env-production.company.io",
"state": "SUCCESS"
}
]
Expand All @@ -45,8 +46,8 @@
"cursor": "Y3Vyc29yOnYyOpK0MjAyMi0wMi0wM1QyMjo0NTowM1rOHdDZeg==",
"node": {
"repository": {
"id": 42,
"node_id": "pK0MjAyMi0wMi0wM1QyMj",
"id": 42,
"node_id": "pK0MjAyMi0wMi0wM1QyMj",
"name": "test-repo-name",
"owner": {
"login": "test-repo-owner"
Expand All @@ -62,7 +63,7 @@
"environment": "prod",
"description": "",
"latestStatus": {
"environmentUrl": "",
"environmentUrl": "https://test-repo-url.env-production.company.io",
"logUrl": "https://github.com/test-repo-owner/test-repo-name/commit/7544f2fec0321a32d5effd421682463c2ebd5018/checks",
"state": "success",
"id": "DES_kwDOGtdD5840PkSo",
Expand All @@ -73,6 +74,7 @@
{
"createdAt": "2022-02-03T22:45:04Z",
"updatedAt": "2022-02-03T22:45:04Z",
"environmentUrl": "https://test-repo-url.env-production.company.io",
"state": "SUCCESS"
}
]
Expand Down
17 changes: 10 additions & 7 deletions test/fixtures/api/graphql/deployment-nodes.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
"cursor": "Y3Vyc29yOnYyOpK0MjAyMi0wMi0wM1QyMjo0NTowM1rOHdDZeg==",
"node": {
"createdAt": "2022-02-03T22:45:04Z",
"updatedAt": "2022-02-03T22:45:04Z",
"updatedAt": "2022-02-03T22:45:04Z",
"repository": {
"id": 19,
"node_id": "AyMi0wMi0wM1QyMjo0NT",
"id": 19,
"node_id": "AyMi0wMi0wM1QyMjo0NT",
"name": "test-repo-name",
"owner": {
"login": "test-repo-owner"
Expand All @@ -26,7 +26,7 @@
"environment": "prod",
"description": "",
"latestStatus": {
"environmentUrl": "",
"environmentUrl": "https://test-repo-url.env-production.company.io",
"logUrl": null,
"state": "INACTIVE",
"id": "DES_kwDOGtdD5840PkSo",
Expand All @@ -39,19 +39,22 @@
"createdAt": "2022-02-03T22:45:04Z",
"updatedAt": "2022-02-03T22:45:04Z",
"state": "INACTIVE",
"logUrl": null
"environmentUrl": "https://test-repo-url.env-production.company.io",
"logUrl": null
},
{
"createdAt": "2022-02-03T22:45:04Z",
"updatedAt": "2022-02-03T22:45:04Z",
"state": "SUCCESS",
"logUrl": "random-success"
"environmentUrl": "https://test-repo-url.env-production.company.io",
"logUrl": "random-success"
},
{
"createdAt": "2022-02-03T22:45:04Z",
"updatedAt": "2022-02-03T22:45:04Z",
"state": "IN_PROGRESS",
"logUrl": "random-in-progress"
"environmentUrl": "",
"logUrl": "random-in-progress"
}
]
}
Expand Down
1 change: 1 addition & 0 deletions test/fixtures/deployment_status-basic.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
},
"description": "",
"environment": "Production",
"environment_url": "https://test-repo-url.env-production.company.io",
"target_url": "test-repo-url/commit/885bee1-commit-id-1c458/checks",
"created_at": "2021-06-28T12:15:18Z",
"updated_at": "2021-06-28T12:15:18Z"
Expand Down