add jenkins from master

This commit is contained in:
Jerry 2021-04-20 16:04:42 +08:00
parent e64e7fcae2
commit e5fe80cb76
5 changed files with 67 additions and 1 deletions

2
.gitee/Dockerfile Normal file

@ -0,0 +1,2 @@
FROM python:3
RUN pip3 install requests

31
.gitee/callback.py Normal file

@ -0,0 +1,31 @@
import os
import requests
import json
# sha=os.system("git rev-parse HEAD")
sha = os.getenv("GIT_COMMIT")
# sha = '48fed26c51a8c42554e45f72f43e49703e04c97f'
#get sha from environment
url = "https://gitee.com/api/v5/repos/deepin-community-store/spark-store/commits/{}/comments".format(sha)
token = os.getenv("gitee_token")
# process = os.popen("git symbolic-ref --short -q HEAD")
body = "构建详情请见" + os.getenv("JENKINS_URL") + "blue/organizations/jenkins/" + os.getenv("JOB_NAME").replace("/", "/detail/") + "/" + str(os.getenv("BUILD_ID"))
# process.close()
d = {
'access_token': token,
"body": body
}
h = {
"Content-Type": "application/json;charset=UTF-8"
}
res = requests.post(url,headers=h, data=json.dumps(d))
# print(res.status_code)
# print(res.content)

33
Jenkinsfile vendored Normal file

@ -0,0 +1,33 @@
pipeline {
agent any
stages {
stage('build') {
agent {
docker {
image 'jerry979/dtke:5.11'
}
}
steps {
sh 'mkdir build && cd build && qmake .. && make '
archiveArtifacts(artifacts: 'build/src/spark-store', allowEmptyArchive: true, defaultExcludes: true)
}
}
stage('send') {
agent {
dockerfile {
filename '.gitee/Dockerfile'
}
}
environment {
gitee_token = credentials('1')
}
steps {
sh "python3 .gitee/callback.py"
}
}
}
}

@ -64,6 +64,6 @@
<file>tags/dwine2-small.png</file>
</qresource>
<qresource prefix="/fonts">
<file>fonts/华康少女字体.ttf</file>
<file>fonts/hksnzt.ttf</file>
</qresource>
</RCC>