Skip to content

Commit

Permalink
Allow CI for any branch
Browse files Browse the repository at this point in the history
  • Loading branch information
tiagobento committed May 10, 2024
1 parent fcede17 commit 8011572
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 15 deletions.
10 changes: 5 additions & 5 deletions .ci/jenkins/ci-jobs/Jenkinsfile.ci-image-build
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ pipeline {
agent any

parameters {
string(description: 'Image tag', name: 'IMAGE_TAG', defaultValue: 'latest')
string(description: 'Image tag', name: 'IMAGE_TAG', defaultValue: env.BRANCH_NAME)
}

environment {
Expand Down Expand Up @@ -80,20 +80,20 @@ pipeline {
}

// Trigger by PR = Tag is GIT commit hash and it has expiration = 1d
// Trigger by Branch = Tags are GIT commit and latest and they have no expiration
// Trigger by Branch = Tags are GIT commit and "env.BRANCH_NAME" and they have no expiration
stage('Build image') {
when {
expression { !IMAGE_EXISTS }
}
steps {
dir('kie-tools') {
script {
if (!env.CHANGE_ID && env.BRANCH_NAME == 'main') {
if (!env.CHANGE_ID) {
sh """
docker build -t ${IMAGE_NAME_TAG} -f .ci/kie-tools-ci-build.Dockerfile .
docker tag ${IMAGE_NAME_TAG} ${IMAGE_ACCOUNT}/${IMAGE_NAME}:latest
docker tag ${IMAGE_NAME_TAG} ${IMAGE_ACCOUNT}/${IMAGE_NAME}:${env.BRANCH_NAME}
"""
IMAGE_TAGS = "${params.IMAGE_TAG} latest"
IMAGE_TAGS = "${params.IMAGE_TAG}"
} else {
sh "docker build -t ${IMAGE_NAME_TAG} --label 'quay.expires-after=1d' -f .ci/kie-tools-ci-build.Dockerfile ."
IMAGE_TAGS = "${params.IMAGE_TAG}"
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/ci_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ name: "CI :: Build"

on:
push:
branches: [main]
branches: ["**"]
pull_request:
branches: ["**"]
types: [opened, reopened, ready_for_review, synchronize]

concurrency:
group: ${{ github.event.pull_request && format('ci-build-full-pr-{0}', github.event.pull_request.number) || format('ci-build-full-push-main-{0}', github.sha) }}
group: ${{ github.event.pull_request && format('ci-build-full-pr-{0}', github.event.pull_request.number) || format('ci-build-full-push-{0}', github.sha) }}
cancel-in-progress: true

env:
Expand Down Expand Up @@ -133,7 +133,7 @@ jobs:
run: |
eval "pnpm ${{ steps.setup_build_mode.outputs.affectedPnpmFilterString }} --workspace-concurrency=1 build:prod"
- name: "Check tests result (`main` only)"
- name: "Check tests result"
if: always() && !cancelled() && steps.setup_build_mode.outputs.mode != 'none'
uses: actions/github-script@v6
env:
Expand Down Expand Up @@ -172,7 +172,7 @@ jobs:
with:
partition_index: ${{ matrix.partition }}

- name: "Upload end-to-end tests results to Buildkite (`main` only)"
- name: "Upload end-to-end tests results to Buildkite (on `push` only)"
if: always() && !cancelled() && steps.setup_build_mode.outputs.mode != 'none' && !github.event.pull_request
shell: bash
env:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci_check_code_formatting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ name: "CI :: Code formatting"
on:
workflow_dispatch:
push:
branches: [main]
branches: ["**"]
pull_request:
branches: ["**"]

concurrency:
group: ${{ github.event.pull_request && format('check-code-formatting-pr-{0}', github.event.pull_request.number) || format('check-code-formatting-push-main-{0}', github.sha) }}
group: ${{ github.event.pull_request && format('check-code-formatting-pr-{0}', github.event.pull_request.number) || format('check-code-formatting-push-{0}', github.sha) }}
cancel-in-progress: true

jobs:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci_check_dependencies_consistency.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ name: "CI :: Dependencies consistency"
on:
workflow_dispatch:
push:
branches: [main]
branches: ["**"]
pull_request:
branches: ["**"]

concurrency:
group: ${{ github.event.pull_request && format('check-dependencies-consistency-pr-{0}', github.event.pull_request.number) || format('check-dependencies-consistency-push-main-{0}', github.sha) }}
group: ${{ github.event.pull_request && format('check-dependencies-consistency-pr-{0}', github.event.pull_request.number) || format('check-dependencies-consistency-push-{0}', github.sha) }}
cancel-in-progress: true

jobs:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci_codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ name: "CI :: CodeQL"

on:
push:
branches: [main]
branches: ["**"]
pull_request:
# The branches below must be a subset of the branches above
branches: [main]
branches: ["**"]
schedule:
- cron: "31 15 * * 0"

Expand Down

0 comments on commit 8011572

Please sign in to comment.