From 6155dceffaa21151484651ab77ceb1bbc474a3be Mon Sep 17 00:00:00 2001 From: jaimergp Date: Thu, 3 Oct 2024 19:55:27 +0200 Subject: [PATCH 1/5] Implement manual skip stage for PRs --- .../templates/azure-pipelines.yml.tmpl | 44 ++++++++++++++----- 1 file changed, 32 insertions(+), 12 deletions(-) diff --git a/conda_smithy/templates/azure-pipelines.yml.tmpl b/conda_smithy/templates/azure-pipelines.yml.tmpl index 5da1ef821..5196af2ad 100644 --- a/conda_smithy/templates/azure-pipelines.yml.tmpl +++ b/conda_smithy/templates/azure-pipelines.yml.tmpl @@ -10,15 +10,35 @@ {%- endif %} {%- endfor %} -jobs: - {%- for platform in platformset %} - {%- if platform == 'win' %} - - template: ./.azure-pipelines/azure-pipelines-win.yml - {%- endif %} - {%- if platform == 'osx' %} - - template: ./.azure-pipelines/azure-pipelines-osx.yml - {%- endif %} - {%- if platform == 'linux' %} - - template: ./.azure-pipelines/azure-pipelines-linux.yml - {%- endif %} - {%- endfor %} +stages: +- stage: Check + jobs: + - job: Skip + pool: + vmImage: 'ubuntu-22.04' + variables: + DECODE_PERCENTS: 'false' + RET: 'true' + steps: + - bash: | + git_log=`git log --max-count=1 --skip=1 --pretty=format:"%B" | tr "\n" " "` + echo "##vso[task.setvariable variable=log]$git_log" + - bash: echo "##vso[task.setvariable variable=RET]false" + condition: or(contains(variables.log, '[skip azp]'), contains(variables.log, '[azp skip]'), contains(variables.log, '[skip ci]'), contains(variables.log, '[ci skip]')) + - bash: echo "##vso[task.setvariable variable=start_main;isOutput=true]$RET" + name: result +- stage: Build + condition: and(succeeded(), eq(dependencies.Check.outputs['Skip.result.start_main'], 'true')) + dependsOn: Check + jobs: + {%- for platform in platformset %} + {%- if platform == 'win' %} + - template: ./.azure-pipelines/azure-pipelines-win.yml + {%- endif %} + {%- if platform == 'osx' %} + - template: ./.azure-pipelines/azure-pipelines-osx.yml + {%- endif %} + {%- if platform == 'linux' %} + - template: ./.azure-pipelines/azure-pipelines-linux.yml + {%- endif %} + {%- endfor %} From 36a33b1e83a545c57bf48f9b8c7597aea7a5abed Mon Sep 17 00:00:00 2001 From: jaimergp Date: Thu, 3 Oct 2024 19:59:25 +0200 Subject: [PATCH 2/5] add news --- news/2077-azure-skips.rst | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 news/2077-azure-skips.rst diff --git a/news/2077-azure-skips.rst b/news/2077-azure-skips.rst new file mode 100644 index 000000000..10105322d --- /dev/null +++ b/news/2077-azure-skips.rst @@ -0,0 +1,24 @@ +**Added:** + +* + +**Changed:** + +* + +**Deprecated:** + +* + +**Removed:** + +* + +**Fixed:** + +* Azure Pipelines will now skip build jobs if the last commit message contains one of + ``[skip ci]``, ``[ci skip]``, ``[skip azp]``, or ``[azp skip]``. (#2077) + +**Security:** + +* From 0eb5535385d62339290b6f0d11d89e707b8e1e85 Mon Sep 17 00:00:00 2001 From: jaimergp Date: Thu, 3 Oct 2024 20:18:05 +0200 Subject: [PATCH 3/5] faster and prettier --- conda_smithy/templates/azure-pipelines.yml.tmpl | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/conda_smithy/templates/azure-pipelines.yml.tmpl b/conda_smithy/templates/azure-pipelines.yml.tmpl index 5196af2ad..d71338d3f 100644 --- a/conda_smithy/templates/azure-pipelines.yml.tmpl +++ b/conda_smithy/templates/azure-pipelines.yml.tmpl @@ -20,13 +20,18 @@ stages: DECODE_PERCENTS: 'false' RET: 'true' steps: + - checkout: self + fetchDepth: '1' - bash: | git_log=`git log --max-count=1 --skip=1 --pretty=format:"%B" | tr "\n" " "` echo "##vso[task.setvariable variable=log]$git_log" + displayName: Obtain commit message - bash: echo "##vso[task.setvariable variable=RET]false" condition: or(contains(variables.log, '[skip azp]'), contains(variables.log, '[azp skip]'), contains(variables.log, '[skip ci]'), contains(variables.log, '[ci skip]')) + displayName: Skip build? - bash: echo "##vso[task.setvariable variable=start_main;isOutput=true]$RET" name: result + displayName: Export result - stage: Build condition: and(succeeded(), eq(dependencies.Check.outputs['Skip.result.start_main'], 'true')) dependsOn: Check From 7e62aa5495f0e4177be55be4acb061ab7c29f310 Mon Sep 17 00:00:00 2001 From: jaimergp Date: Thu, 3 Oct 2024 20:18:33 +0200 Subject: [PATCH 4/5] pre-commit --- news/2077-azure-skips.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/news/2077-azure-skips.rst b/news/2077-azure-skips.rst index 10105322d..a73b8e3a2 100644 --- a/news/2077-azure-skips.rst +++ b/news/2077-azure-skips.rst @@ -16,7 +16,7 @@ **Fixed:** -* Azure Pipelines will now skip build jobs if the last commit message contains one of +* Azure Pipelines will now skip build jobs if the last commit message contains one of ``[skip ci]``, ``[ci skip]``, ``[skip azp]``, or ``[azp skip]``. (#2077) **Security:** From 590a9b8d529e52f85de63e4e810719e97f8aadee Mon Sep 17 00:00:00 2001 From: jaimergp Date: Thu, 3 Oct 2024 20:38:30 +0200 Subject: [PATCH 5/5] fetch two --- conda_smithy/templates/azure-pipelines.yml.tmpl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/conda_smithy/templates/azure-pipelines.yml.tmpl b/conda_smithy/templates/azure-pipelines.yml.tmpl index d71338d3f..0d60d89f6 100644 --- a/conda_smithy/templates/azure-pipelines.yml.tmpl +++ b/conda_smithy/templates/azure-pipelines.yml.tmpl @@ -21,7 +21,8 @@ stages: RET: 'true' steps: - checkout: self - fetchDepth: '1' + {# We only need two: the PR merge commit, and the actual commit added by the user #} + fetchDepth: '2' - bash: | git_log=`git log --max-count=1 --skip=1 --pretty=format:"%B" | tr "\n" " "` echo "##vso[task.setvariable variable=log]$git_log"