mirror of
https://gitee.com/milvus-io/milvus.git
synced 2026-01-07 19:31:51 +08:00
[skip ci] Add jenkins check in github actions (#12278)
Signed-off-by: Jenny Li <jing.li@zilliz.com>
This commit is contained in:
parent
2ee0c7c074
commit
78d57a19a0
56
.github/workflows/jenkins-checker.yaml
vendored
Normal file
56
.github/workflows/jenkins-checker.yaml
vendored
Normal file
@ -0,0 +1,56 @@
|
||||
name: Jenkins Checker
|
||||
# Lint Jenkinsfile and related groovy files
|
||||
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
# file paths to consider in the event. Optional; defaults to all.
|
||||
paths:
|
||||
- 'build/ci/jenkins/**'
|
||||
jobs:
|
||||
check-jenkinsfile:
|
||||
name: Jenkinsfile Checker
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
- name: Validate Jenkinsfile
|
||||
shell: bash
|
||||
run: |
|
||||
JENKINS_URL=https://ci.milvus.io:18080/jenkins
|
||||
# JENKINS_CRUMB is needed if your Jenkins controller has CRSF protection enabled as it should
|
||||
JENKINS_CRUMB=`curl "$JENKINS_URL/crumbIssuer/api/xml?xpath=concat(//crumbRequestField,\":\",//crumb)"`
|
||||
|
||||
function validate(){
|
||||
local file_path=${1:-Jenkinsfile}
|
||||
response=$(curl -X POST -H $JENKINS_CRUMB -F "jenkinsfile=<${file_path}" $JENKINS_URL/pipeline-model-converter/validate)
|
||||
|
||||
if [[ ${response} =~ "Error" ]]
|
||||
then
|
||||
echo " ${response}"
|
||||
echo "Validate ${file_path} failed !"
|
||||
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
for file in build/ci/jenkins/*
|
||||
do
|
||||
if [ -f "$file" ]
|
||||
then
|
||||
echo "$file"
|
||||
file_name=$(basename "$file")
|
||||
|
||||
if echo "${file_name}" | grep -q -E '\.groovy$'
|
||||
then
|
||||
echo "Validate groovy file ${file_name}"
|
||||
validate $file
|
||||
elif [[ "${file_name}" == "Jenkinsfile" ]]
|
||||
then
|
||||
echo "Validate Jenkinsfile"
|
||||
validate $file
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user