From 019584a78c4cecd7522b939a395b3be754a82e2b Mon Sep 17 00:00:00 2001 From: Grigoriy Bykov Date: Wed, 23 Oct 2024 11:25:32 +0300 Subject: [PATCH 1/2] Fix using `head_pipeline` instead of `pipeline` in GitLab - Due to [GitLab docs](https://docs.gitlab.com/ee/api/merge_requests.html) we should prefer using head_pipeline instead of pipeline as it contains more information --- .../main/kotlin/systems/danger/kotlin/models/gitlab/GitLab.kt | 1 + .../src/test/resources/gitlabDangerJSON.json | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/danger-kotlin-library/src/main/kotlin/systems/danger/kotlin/models/gitlab/GitLab.kt b/danger-kotlin-library/src/main/kotlin/systems/danger/kotlin/models/gitlab/GitLab.kt index 9737cef8..603861d1 100644 --- a/danger-kotlin-library/src/main/kotlin/systems/danger/kotlin/models/gitlab/GitLab.kt +++ b/danger-kotlin-library/src/main/kotlin/systems/danger/kotlin/models/gitlab/GitLab.kt @@ -73,6 +73,7 @@ data class GitLabMergeRequest( @SerialName("merge_when_pipeline_succeeds") val mergeOnPipelineSuccess: Boolean, val milestone: GitLabMilestone? = null, + @SerialName("head_pipeline") val pipeline: GitLabPipeline, @SerialName("project_id") val projectId: String, diff --git a/danger-kotlin-library/src/test/resources/gitlabDangerJSON.json b/danger-kotlin-library/src/test/resources/gitlabDangerJSON.json index 0c9e5507..fe607bcb 100644 --- a/danger-kotlin-library/src/test/resources/gitlabDangerJSON.json +++ b/danger-kotlin-library/src/test/resources/gitlabDangerJSON.json @@ -113,14 +113,14 @@ "latest_build_started_at": "2021-04-30T14:35:00.103+02:00", "latest_build_finished_at": "2019-04-11T00:33:22.492Z", "first_deployed_to_production_at": "2019-04-11T00:30:22.492Z", - "pipeline": { + "pipeline": null, + "head_pipeline": { "id": 50, "sha": "621bc3348549e51c5bd6ea9f094913e9e4667c7b", "ref": "ef28580bb2a00d985bffe4a4ce3fe09fdb12283f", "status": "success", "web_url": "https://gitlab.com/danger-systems/danger.systems/pipeline/621bc3348549e51c5bd6ea9f094913e9e4667c7b" }, - "head_pipeline": null, "diff_refs": { "base_sha": "ef28580bb2a00d985bffe4a4ce3fe09fdb12283f", "head_sha": "621bc3348549e51c5bd6ea9f094913e9e4667c7b", From f4dcedaa3ac7da161ffa884f35b2f98121a1b6ac Mon Sep 17 00:00:00 2001 From: Grigoriy Bykov Date: Wed, 23 Oct 2024 11:34:09 +0300 Subject: [PATCH 2/2] Fix using `head_pipeline` instead of `pipeline` in GitLab - Fix Gitlab pipeline status test --- .../test/resources/gitlabWithCancelledPipelineDangerJSON.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/danger-kotlin-library/src/test/resources/gitlabWithCancelledPipelineDangerJSON.json b/danger-kotlin-library/src/test/resources/gitlabWithCancelledPipelineDangerJSON.json index 8f56ed97..026663d0 100644 --- a/danger-kotlin-library/src/test/resources/gitlabWithCancelledPipelineDangerJSON.json +++ b/danger-kotlin-library/src/test/resources/gitlabWithCancelledPipelineDangerJSON.json @@ -113,14 +113,14 @@ "latest_build_started_at": "2021-04-30T14:35:00.103+02:00", "latest_build_finished_at": "2019-04-11T00:33:22.492Z", "first_deployed_to_production_at": "2019-04-11T00:30:22.492Z", - "pipeline": { + "pipeline": null, + "head_pipeline": { "id": 50, "sha": "621bc3348549e51c5bd6ea9f094913e9e4667c7b", "ref": "ef28580bb2a00d985bffe4a4ce3fe09fdb12283f", "status": "canceled", "web_url": "https://gitlab.com/danger-systems/danger.systems/pipeline/621bc3348549e51c5bd6ea9f094913e9e4667c7b" }, - "head_pipeline": null, "diff_refs": { "base_sha": "ef28580bb2a00d985bffe4a4ce3fe09fdb12283f", "head_sha": "621bc3348549e51c5bd6ea9f094913e9e4667c7b",