Skip to content

Commit

Permalink
KOGITO-8110 Correct GHA DSL checks and seed test script (apache#646)
Browse files Browse the repository at this point in the history
* Correct GHA DSL tests

Co-authored-by: Enrique Mingorance Cano <ginxaco@gmail.com>

* updated seed test script

* cleanup

Co-authored-by: Enrique Mingorance Cano <ginxaco@gmail.com>
  • Loading branch information
radtriste and Ginxo authored Oct 14, 2022
1 parent e6ccefd commit 3aef481
Show file tree
Hide file tree
Showing 8 changed files with 351 additions and 257 deletions.
45 changes: 26 additions & 19 deletions .ci/actions/dsl-tests/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,15 @@ name: 'DSL tests'
description: 'Tests DSL generation'
inputs:
repository:
description: author/repository to check
description: author/repository to test
required: false
reference:
description: reference to test
required: false
jobs-folder-path:
description: folder path where to find the jobs.groovy file
required: false
default: .ci/jenkins/dsl
main-config-file-repo:
description: author/repository to find the main config file
required: false
Expand All @@ -13,21 +20,13 @@ inputs:
main-config-file-path:
description: path to find the main config file
required: false
branch-config-branch:
description: branch config branch to look for
required: false
deprecationMessage: Please use the `branch-config-name` input instead
branch-config-name:
description: branch config name to look for
required: false
base-branch:
description: base branch for the checks
required: false
default: ''
jobs-folder-path:
description: folder path where to find the jobs.groovy file
required: false
default: .ci/jenkins/dsl
save-results:
description: whether results of testing should be saved. Default to true.
required: false
Expand All @@ -42,7 +41,7 @@ runs:
java-version: 11

- name: Checkout Seed repo
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
repository: kiegroup/kogito-pipelines
ref: main
Expand All @@ -63,23 +62,31 @@ runs:
echo "Using pipelines test dir ${pipelines_test_dir}"
echo "PIPELINES_TEST_DIR=${pipelines_test_dir}" >> $GITHUB_ENV
- name: Checkout current repo
uses: actions/checkout@v3
with:
path: dsl-tests-dir

- name: Test DSL
shell: bash
working-directory: seed_repo
working-directory: dsl-tests-dir
env:
DSL_DEFAULT_REPOSITORY: ${{ inputs.repository }}
DSL_DEFAULT_TEST_REPO: ${{ inputs.repository }}
DSL_DEFAULT_TEST_REF: ${{ inputs.reference }}

DSL_DEFAULT_MAIN_CONFIG_FILE_REPO: ${{ inputs.main-config-file-repo }}
DSL_DEFAULT_MAIN_CONFIG_FILE_REF: ${{ inputs.main-config-file-ref }}
DSL_DEFAULT_MAIN_CONFIG_FILE_PATH: ${{ inputs.main-config-file-path }}

DSL_DEFAULT_BRANCH_CONFIG_NAME: ${{ inputs.branch-config-name }}
DSL_DEFAULT_BRANCH_CONFIG_BRANCH: ${{ inputs.branch-config-branch }}
PIPELINES_TEST_DIR: ${{ env.PIPELINES_TEST_DIR }}

DSL_DEFAULT_FALLBACK_PIPELINES_REF: ${{ env.BASE_BRANCH }}
DSL_DEFAULT_PIPELINES_TEST_DIR: ${{ env.PIPELINES_TEST_DIR }}

DSL_DEFAULT_CURRENT_REPOSITORY: ${{ github.event.pull_request.head.repo.full_name }}
DSL_DEFAULT_CURRENT_REF: ${{ github.event.pull_request.head.ref }}
run: |
dsl/seed/scripts/seed_test.sh -h ${{ github.head_ref }} \
-r ${{ github.event.pull_request.head.repo.full_name }} \
-b ${{ env.BASE_BRANCH }} \
-t ${{ github.event.pull_request.base.repo.full_name }} \
${{ inputs.jobs-folder-path }}
${GITHUB_WORKSPACE}/seed_repo/dsl/seed/scripts/seed_test.sh ${{ inputs.jobs-folder-path }}
- name: Setup upload artifact name
if: ${{ always() && inputs.save-results }}
Expand Down
2 changes: 1 addition & 1 deletion .ci/actions/maven/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ description: 'Java and Maven version setup'
inputs:
java-version:
description: "the java version"
default: 11
default: "11"
required: false
maven-version:
description: "the maven version"
Expand Down
4 changes: 0 additions & 4 deletions .ci/jenkins/dsl/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,4 @@

SCRIPT_DIR_PATH=`dirname "${BASH_SOURCE[0]}"`

export DSL_DEFAULT_MAIN_CONFIG_FILE_REPO=kiegroup/kogito-pipelines
export DSL_DEFAULT_MAIN_CONFIG_FILE_REF=main
export DSL_DEFAULT_MAIN_CONFIG_FILE_PATH=dsl/config/main.yaml

${SCRIPT_DIR_PATH}/../../../dsl/seed/scripts/seed_test.sh $@
28 changes: 12 additions & 16 deletions .github/workflows/jenkins-dsl-downstream.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
#############################################################################
getKogitoDslDownstreamMatrix:
concurrency:
group: kogito_pipelines_pr-dsl_kogito_downstream_matrix-${{ github.head_ref }}
group: ${{ github.repository.name }}-dsl_kogito_downstream_matrix-${{ github.head_ref }}
cancel-in-progress: true
runs-on: ubuntu-latest
name: Get Kogito DSL downstream projects
Expand All @@ -35,7 +35,7 @@ jobs:
yq --version
- name: Checkout Main Config repo from main branch
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
repository: kiegroup/kogito-pipelines
ref: main
Expand Down Expand Up @@ -98,7 +98,7 @@ jobs:
- name: Checkout branch config repo
if: ${{ env.BRANCH_CONFIG_UNKNOWN != 'true' }}
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
repository: ${{ env.BRANCH_CONFIG_GIT_AUTHOR }}/${{ env.BRANCH_CONFIG_GIT_REPOSITORY }}
ref: ${{ env.BRANCH_CONFIG_GIT_BRANCH }}
Expand All @@ -109,10 +109,9 @@ jobs:
working-directory: branch_config_repo
run: |
matrixArray=''
defaultAuthor=kiegroup
defaultAuthor=${{ github.event.pull_request.head.user.login }}
if [ "${{ env.BRANCH_CONFIG_UNKNOWN }}" != "true" ]; then
matrixArray=$(yq '.repositories[].name' ${{ env.BRANCH_CONFIG_PATH }}) # Creates array of all repositories
defaultAuthor=$(yq '.git.author.name' ${{ env.BRANCH_CONFIG_PATH }})
fi
fullArray=()
Expand All @@ -135,12 +134,11 @@ jobs:
cat ./tmp
# End Generate Json String
matrixStringifiedObject=$(cat ./tmp) # Use this as jq @sh wasn't cooperating
echo "::set-output name=repositories::$matrixStringifiedObject"
echo "repositories=$(cat ./tmp)" >> $GITHUB_OUTPUT # Use this as jq @sh wasn't cooperating
runKogitoDownstreamDslTests:
concurrency:
group: kogito_pipelines_pr-dsl_kogito_downstream_${{ matrix.repository }}_tests-${{ github.head_ref }}
group: ${{ github.repository.name }}-dsl_kogito_downstream_${{ matrix.repository }}_tests-${{ github.head_ref }}
cancel-in-progress: true
runs-on: ubuntu-latest
needs: getKogitoDslDownstreamMatrix
Expand Down Expand Up @@ -177,7 +175,7 @@ jobs:
#############################################################################
getOptaPlannerDslDownstreamMatrix:
concurrency:
group: kogito_pipelines_pr-dsl_optaplanner_downstream_matrix-${{ github.head_ref }}
group: ${{ github.repository.name }}-dsl_optaplanner_downstream_matrix-${{ github.head_ref }}
cancel-in-progress: true
runs-on: ubuntu-latest
name: Get OptaPlanner DSL downstream projects
Expand All @@ -201,7 +199,7 @@ jobs:
yq --version
- name: Checkout Main Config repo from main branch
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
repository: kiegroup/optaplanner
ref: main
Expand Down Expand Up @@ -266,7 +264,7 @@ jobs:
- name: Checkout branch config repo
if: ${{ env.BRANCH_CONFIG_UNKNOWN != 'true' }}
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
repository: ${{ env.BRANCH_CONFIG_GIT_AUTHOR }}/${{ env.BRANCH_CONFIG_GIT_REPOSITORY }}
ref: ${{ env.BRANCH_CONFIG_GIT_BRANCH }}
Expand All @@ -277,10 +275,9 @@ jobs:
working-directory: branch_config_repo
run: |
matrixArray=''
defaultAuthor=kiegroup
defaultAuthor=${{ github.event.pull_request.head.user.login }}
if [ "${{ env.BRANCH_CONFIG_UNKNOWN }}" != "true" ]; then
matrixArray=$(yq '.repositories[].name' ${{ env.BRANCH_CONFIG_PATH }}) # Creates array of all repositories
defaultAuthor=$(yq '.git.author.name' ${{ env.BRANCH_CONFIG_PATH }})
fi
fullArray=()
Expand All @@ -303,8 +300,7 @@ jobs:
cat ./tmp
# End Generate Json String
matrixStringifiedObject=$(cat ./tmp) # Use this as jq @sh wasn't cooperating
echo "::set-output name=repositories::$matrixStringifiedObject"
echo "repositories=$(cat ./tmp)" >> $GITHUB_OUTPUT # Use this as jq @sh wasn't cooperating
runOtaPlannerDownstreamDslTests:
Expand All @@ -314,7 +310,7 @@ jobs:
matrix: ${{fromJson(needs.getOptaPlannerDslDownstreamMatrix.outputs.matrix)}}
fail-fast: false
concurrency:
group: kogito_pipelines_pr-dsl_optaplanner_downstream_${{ matrix.repository }}_tests-${{ github.head_ref }}
group: ${{ github.repository.name }}-dsl_optaplanner_downstream_${{ matrix.repository }}_tests-${{ github.head_ref }}
cancel-in-progress: true
name: OptaPlanner DSL Downstream tests - ${{ matrix.repository }}
steps:
Expand Down
13 changes: 8 additions & 5 deletions .github/workflows/jenkins-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,26 +14,26 @@ on:
jobs:
jenkinsfile-tests:
concurrency:
group: kogito_pipelines_pr-jenkins_tests-${{ github.head_ref }}
group: ${{ github.repository.name }}-jenkinsfile_tests-${{ github.head_ref }}
cancel-in-progress: true
runs-on: ubuntu-latest
name: Jenkinsfiles
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
path: main

- name: Checkout shared libraries
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
repository: kiegroup/jenkins-pipeline-shared-libraries
path: shared-libs

- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
java-version: 8

- name: Setup pipeline env
run: cd $GITHUB_WORKSPACE/main/.ci/jenkins/tests && ./setup_pipeline_env.sh
Expand All @@ -42,8 +42,11 @@ jobs:
run: cd $GITHUB_WORKSPACE/main/.ci/jenkins/tests && mvn -B clean test

dsl-tests:
concurrency:
group: ${{ github.repository.name }}-dsl_tests-${{ github.head_ref }}
cancel-in-progress: true
runs-on: ubuntu-latest
steps:
steps:
- name: DSL tests
uses: kiegroup/kogito-pipelines/.ci/actions/dsl-tests@main
with:
Expand Down
7 changes: 0 additions & 7 deletions dsl/seed/scripts/copy_jobs.sh

This file was deleted.

Loading

0 comments on commit 3aef481

Please sign in to comment.