Skip to content

Commit

Permalink
enh(ci): run push and publish jobs only on centreon/centreon
Browse files Browse the repository at this point in the history
  • Loading branch information
tuntoja committed Dec 5, 2024
1 parent 13cf396 commit c9697bc
Show file tree
Hide file tree
Showing 12 changed files with 48 additions and 25 deletions.
23 changes: 17 additions & 6 deletions .github/workflows/centreon-collect.yml
Original file line number Diff line number Diff line change
Expand Up @@ -301,13 +301,15 @@ jobs:
jira_base_url: ${{ secrets.JIRA_BASE_URL }}
jira_user_email: ${{ secrets.XRAY_JIRA_USER_EMAIL }}
jira_api_token: ${{ secrets.XRAY_JIRA_TOKEN }}

robot-test:
needs: [get-environment, package]
if: |
needs.get-environment.outputs.is_nightly == 'true' &&
! cancelled() &&
! contains(needs.*.result, 'failure') &&
! contains(needs.*.result, 'cancelled')
! contains(needs.*.result, 'cancelled') &&
github.repository == 'centreon/centreon-collect-collect'
strategy:
fail-fast: false
Expand Down Expand Up @@ -374,6 +376,7 @@ jobs:
jira_base_url: ${{ secrets.JIRA_BASE_URL }}
jira_user_email: ${{ secrets.XRAY_JIRA_USER_EMAIL }}
jira_api_token: ${{ secrets.XRAY_JIRA_TOKEN }}

deliver-sources:
runs-on: [self-hosted, common]
needs: [get-environment, package]
Expand All @@ -382,7 +385,8 @@ jobs:
contains(fromJson('["stable"]'), needs.get-environment.outputs.stability) &&
! cancelled() &&
! contains(needs.*.result, 'failure') &&
! contains(needs.*.result, 'cancelled')
! contains(needs.*.result, 'cancelled') &&
github.repository == 'centreon/centreon-collect-collect'
steps:
- name: Checkout sources
Expand All @@ -405,7 +409,9 @@ jobs:
contains(fromJson('["unstable", "testing"]'), needs.get-environment.outputs.stability) &&
! cancelled() &&
! contains(needs.*.result, 'failure') &&
! contains(needs.*.result, 'cancelled')
! contains(needs.*.result, 'cancelled') &&
github.repository == 'centreon/centreon-collect'
needs: [get-environment, robot-test]
runs-on: [self-hosted, common]
strategy:
Expand Down Expand Up @@ -452,7 +458,9 @@ jobs:
contains(fromJson('["unstable", "testing"]'), needs.get-environment.outputs.stability) &&
! cancelled() &&
! contains(needs.*.result, 'failure') &&
! contains(needs.*.result, 'cancelled')
! contains(needs.*.result, 'cancelled') &&
github.repository == 'centreon/centreon-collect'
needs: [get-environment, robot-test]
runs-on: [self-hosted, common]
strategy:
Expand Down Expand Up @@ -485,7 +493,8 @@ jobs:
if: |
needs.get-environment.outputs.is_nightly == 'true' && github.run_attempt == 1 &&
failure() &&
startsWith(github.ref_name, 'dev')
startsWith(github.ref_name, 'dev') &&
github.repository == 'centreon/centreon-collect'
uses: ./.github/actions/create-jira-ticket
with:
jira_base_url: ${{ secrets.JIRA_BASE_URL }}
Expand All @@ -500,7 +509,9 @@ jobs:
(contains(fromJson('["stable", "testing"]'), needs.get-environment.outputs.stability) && github.event_name != 'workflow_dispatch') &&
! cancelled() &&
! contains(needs.*.result, 'failure') &&
! contains(needs.*.result, 'cancelled')
! contains(needs.*.result, 'cancelled') &&
github.repository == 'centreon/centreon-collect'
runs-on: [self-hosted, common]
strategy:
matrix:
Expand Down
8 changes: 5 additions & 3 deletions .github/workflows/centreon-common.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ jobs:
deliver-rpm:
runs-on: [self-hosted, common]
needs: [get-environment, package]
if: ${{ contains(fromJson('["testing", "unstable"]'), needs.get-environment.outputs.stability) }}
if: ${{ contains(fromJson('["testing", "unstable"]'), needs.get-environment.outputs.stability) && github.repository == 'centreon/centreon-collect' }}

strategy:
matrix:
Expand All @@ -118,7 +118,7 @@ jobs:
deliver-deb:
runs-on: [self-hosted, common]
needs: [get-environment, package]
if: ${{ contains(fromJson('["testing", "unstable"]'), needs.get-environment.outputs.stability) }}
if: ${{ contains(fromJson('["testing", "unstable"]'), needs.get-environment.outputs.stability) && github.repository == 'centreon/centreon-collect' }}

strategy:
matrix:
Expand Down Expand Up @@ -146,7 +146,9 @@ jobs:
(contains(fromJson('["stable", "testing"]'), needs.get-environment.outputs.stability) && github.event_name != 'workflow_dispatch') &&
! cancelled() &&
! contains(needs.*.result, 'failure') &&
! contains(needs.*.result, 'cancelled')
! contains(needs.*.result, 'cancelled') &&
github.repository == 'centreon/centreon-collect'
runs-on: [self-hosted, common]
strategy:
matrix:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/docker-builder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ on:

jobs:
get-environment:
if: github.repository == 'centreon/centreon-collect'
uses: ./.github/workflows/get-environment.yml
with:
version_file: CMakeLists.txt
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/docker-gorgone-testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ on:

jobs:
get-environment:
if: github.repository == 'centreon/centreon-collect'
uses: ./.github/workflows/get-environment.yml

dockerize:
Expand Down
11 changes: 7 additions & 4 deletions .github/workflows/gorgone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ jobs:
stability: ${{ needs.get-environment.outputs.stability }}

robot-test-gorgone:
if: github.repository == 'centreon/centreon-collect'
needs: [get-environment, package]

strategy:
Expand Down Expand Up @@ -287,7 +288,7 @@ jobs:
deliver-sources:
runs-on: [self-hosted, common]
needs: [get-environment, package]
if: ${{ contains(fromJson('["stable"]'), needs.get-environment.outputs.stability) && github.event_name != 'workflow_dispatch' }}
if: ${{ contains(fromJson('["stable"]'), needs.get-environment.outputs.stability) && github.event_name != 'workflow_dispatch' && github.repository == 'centreon/centreon-collect' }}

steps:
- name: Checkout sources
Expand All @@ -306,7 +307,7 @@ jobs:
deliver-rpm:
runs-on: [self-hosted, common]
needs: [get-environment, package]
if: ${{ contains(fromJson('["testing", "unstable"]'), needs.get-environment.outputs.stability) }}
if: ${{ contains(fromJson('["testing", "unstable"]'), needs.get-environment.outputs.stability) && github.repository == 'centreon/centreon-collect' }}

strategy:
matrix:
Expand All @@ -331,7 +332,7 @@ jobs:
deliver-deb:
runs-on: [self-hosted, common]
needs: [get-environment, package]
if: ${{ contains(fromJson('["testing", "unstable"]'), needs.get-environment.outputs.stability) }}
if: ${{ contains(fromJson('["testing", "unstable"]'), needs.get-environment.outputs.stability) && github.repository == 'centreon/centreon-collect' }}

strategy:
matrix:
Expand Down Expand Up @@ -359,7 +360,9 @@ jobs:
(contains(fromJson('["stable", "testing"]'), needs.get-environment.outputs.stability) && github.event_name != 'workflow_dispatch') &&
! cancelled() &&
! contains(needs.*.result, 'failure') &&
! contains(needs.*.result, 'cancelled')
! contains(needs.*.result, 'cancelled') &&
github.repository == 'centreon/centreon-collect'
runs-on: [self-hosted, common]
strategy:
matrix:
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/libzmq.yml
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ jobs:
key: ${{ github.run_id }}-${{ github.sha }}-deb-libzmq-${{ matrix.distrib }}-${{ matrix.arch }}

deliver-rpm:
if: ${{ contains(fromJson('["testing", "unstable"]'), needs.get-environment.outputs.stability) }}
if: ${{ contains(fromJson('["testing", "unstable"]'), needs.get-environment.outputs.stability) && github.repository == 'centreon/centreon-collect' }}
needs: [get-environment, package-rpm]
runs-on: [self-hosted, common]
strategy:
Expand Down Expand Up @@ -168,7 +168,7 @@ jobs:
is_cloud: ${{ needs.get-environment.outputs.is_cloud }}

deliver-deb:
if: ${{ contains(fromJson('["testing", "unstable"]'), needs.get-environment.outputs.stability) }}
if: ${{ contains(fromJson('["testing", "unstable"]'), needs.get-environment.outputs.stability) && github.repository == 'centreon/centreon-collect' }}
needs: [get-environment, package-deb]
runs-on: [self-hosted, common]
strategy:
Expand Down Expand Up @@ -203,7 +203,8 @@ jobs:
(contains(fromJson('["stable", "testing"]'), needs.get-environment.outputs.stability) && github.event_name != 'workflow_dispatch') &&
! cancelled() &&
! contains(needs.*.result, 'failure') &&
! contains(needs.*.result, 'cancelled')
! contains(needs.*.result, 'cancelled') &&
github.repository == 'centreon/centreon-collect'
runs-on: [self-hosted, common]
strategy:
matrix:
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/lua-curl.yml
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ jobs:
stability: ${{ needs.get-environment.outputs.stability }}

deliver-rpm:
if: ${{ contains(fromJson('["testing", "unstable"]'), needs.get-environment.outputs.stability) }}
if: ${{ contains(fromJson('["testing", "unstable"]'), needs.get-environment.outputs.stability) && github.repository == 'centreon/centreon-collect' }}
needs: [get-environment, package]
runs-on: ubuntu-24.04
strategy:
Expand Down Expand Up @@ -158,7 +158,7 @@ jobs:
is_cloud: ${{ needs.get-environment.outputs.is_cloud }}

deliver-deb:
if: ${{ contains(fromJson('["testing", "unstable"]'), needs.get-environment.outputs.stability) }}
if: ${{ contains(fromJson('["testing", "unstable"]'), needs.get-environment.outputs.stability) && github.repository == 'centreon/centreon-collect' }}
needs: [get-environment, package]
runs-on: ubuntu-24.04
strategy:
Expand Down Expand Up @@ -192,7 +192,8 @@ jobs:
(contains(fromJson('["stable", "testing"]'), needs.get-environment.outputs.stability) && github.event_name != 'workflow_dispatch') &&
! cancelled() &&
! contains(needs.*.result, 'failure') &&
! contains(needs.*.result, 'cancelled')
! contains(needs.*.result, 'cancelled') &&
github.repository == 'centreon/centreon-collect'
runs-on: [self-hosted, common]
strategy:
matrix:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/rebase-master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
main:
name: Sync Stable Branches
runs-on: ubuntu-24.04
if: github.event.pull_request.merged == true
if: github.event.pull_request.merged == true && github.repository == 'centreon/centreon-collect'
steps:
- name: git checkout
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/rebase-version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
main:
name: Sync Stable Branches
runs-on: ubuntu-24.04
if: github.event.pull_request.merged == true
if: github.event.pull_request.merged == true && github.repository == 'centreon/centreon-collect'
steps:
- name: git checkout
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/release-trigger-builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ on:

jobs:
release-trigger-builds:
if: github.repository == 'centreon/centreon-collect'
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ on:

jobs:
release:
if: ${{ github.event.pull_request.merged == true }}
if: ${{ github.event.pull_request.merged == true && github.repository == 'centreon/centreon-collect' }}
runs-on: ubuntu-24.04
steps:
- name: Check base_ref
Expand Down
8 changes: 5 additions & 3 deletions .github/workflows/windows-agent.yml
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,8 @@ jobs:
contains(fromJson('["stable"]'), needs.get-environment.outputs.stability) &&
! cancelled() &&
! contains(needs.*.result, 'failure') &&
! contains(needs.*.result, 'cancelled'))
! contains(needs.*.result, 'cancelled')) &&
github.repository == 'centreon/centreon-collect'
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
with:
name: packages-centreon-monitoring-agent-windows
Expand All @@ -170,7 +171,8 @@ jobs:
contains(fromJson('["unstable", "testing"]'), needs.get-environment.outputs.stability) &&
! cancelled() &&
! contains(needs.*.result, 'failure') &&
! contains(needs.*.result, 'cancelled')
! contains(needs.*.result, 'cancelled') &&
github.repository == 'centreon/centreon-collect'
run: |
Write-Host "[DEBUG] deliver to testing - Major version: ${{ needs.get-environment.outputs.major_version }}"
Write-Host "[DEBUG] deliver to testing - Minor version: ${{ needs.get-environment.outputs.minor_version }}"
Expand All @@ -190,7 +192,7 @@ jobs:
- name: Promote testing to stable
if: |
needs.get-environment.outputs.stability == 'stable' && github.event_name != 'workflow_dispatch' && ! cancelled()
needs.get-environment.outputs.stability == 'stable' && github.event_name != 'workflow_dispatch' && ! cancelled() && github.repository == 'centreon/centreon-collect'
run: |
Write-Host "[DEBUG] promote to stable - Major version: ${{ needs.get-environment.outputs.major_version }}"
Write-Host "[DEBUG] promote to stable - Minor version: ${{ needs.get-environment.outputs.minor_version }}"
Expand Down

0 comments on commit c9697bc

Please sign in to comment.