The Unified and Autonomous Development Platform
Edit .onedev-buildspec.yml
Robin Shend1cfa0f27bbb
diff --git a/.onedev-buildspec.yml b/.onedev-buildspec.ymlindex 4dd1a79877..2103f360c8 100644--- a/.onedev-buildspec.yml+++ b/.onedev-buildspec.yml@@ -1,190 +1,190 @@-version: 6-jobs:-- name: CI- steps:- - !CheckoutStep- name: 'checkout'- cloneCredential: !DefaultCredential {}- cloneDepth: 1- condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL- - !CommandStep- name: 'detect build version'- image: 1dev/build-environment:1.3- commands:- - set -e- - echo "Detecting project version (may require some time while downloading maven- dependencies)..."- - echo $(mvn org.apache.maven.plugins:maven-help-plugin:3.2.0:evaluate- -Dexpression=project.version -q -DforceStdout) > buildVersion- condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL- - !SetBuildVersion- name: 'set build version'- buildVersion: '@file:buildVersion@'- condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL- - !CommandStep- name: 'test'- image: 1dev/build-environment:1.3- commands:- - mvn test- condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL- triggers:- - !PullRequestUpdateTrigger {}- - !BranchUpdateTrigger {}- retryCondition: never- maxRetries: 3- retryDelay: 30- cpuRequirement: 250m- memoryRequirement: 128m- caches:- - key: maven-cache- path: /root/.m2/repository- timeout: 3600-- name: Release- steps:- - !CheckoutStep- name: 'checkout'- cloneCredential: !HttpCredential- accessTokenSecret: onedev-token- condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL- - !CommandStep- name: 'detect build version '- image: 1dev/build-environment:1.3- commands:- - set -e- - echo "Detecting project version (may require some time while downloading maven- dependencies)..."- - echo $(mvn org.apache.maven.plugins:maven-help-plugin:3.1.0:evaluate- -Dexpression=project.version -q -DforceStdout) > buildVersion- condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL- - !SetBuildVersionStep- name: 'set build version'- buildVersion: '@file:buildVersion@'- condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL- - !CommandStep- name: 'build & deploy'- image: 1dev/build-environment:1.3- commands:- - set -e- - set -o pipefail- - ''- - projectDir=`pwd`- - docker login -u robinshen -p @secrets:dockerhub-password@- - ''- - '# Skip test as we''ve already tested in CI build'- - mvn -Dmaven.test.skip=true -Dmaven.deploy.password=@secrets:maven-deploy-password@- deploy- - ''- - curl -u onedev:@secrets:maven-deploy-password@ -f -d @@/root/.m2/archetype-catalog.xml- -X PUT "https://artifact.onedev.io/artifactory/onedev/archetype-catalog.xml"- - ''- - cd $projectDir/server-product/docker- - ./build.sh- - docker push 1dev/server:${buildVersion}- - docker tag 1dev/server:${buildVersion} 1dev/server:latest- - docker push 1dev/server:latest- - ''- - cd $projectDir/server-product/k8s- - ./build.sh- - ''- - cd $projectDir- - ''- - cp server-product/target/k8s-resources.zip .- - cp server-product/target/onedev-${buildVersion}.zip .- - ''- - cat << EOF > run-as-docker.sh- - docker run -it --rm -v /var/run/docker.sock:/var/run/docker.sock -v \$(pwd)/onedev:/opt/onedev- -p 6610:6610 -p 6611:6611 1dev/server:${buildVersion}- - EOF- - ''- - echo "Creating release tag..."- - git config --global user.name "Robin Shen"- - git config --global user.email "robin@@onedev.io"- - ''- - git tag v@build_version@ -m "Release tag"- - git push -f origin v@build_version@:v@build_version@- - git config --global --unset http.extraHeader- - git push -f https://robin:@secrets:github-token@@@github.com/theonedev/onedev- v@build_version@:v@build_version@- - ''- - echo "Creating release branch in onedev-manual..."- - ''- - cd /onedev-build- - branch=${buildVersion%.*}- - git clone https://robin:@secrets:onedev-token@@@code.onedev.io/onedev-manual- - cd onedev-manual- - if [ "$(git branch -a|grep -c /$branch$)" -eq 0 ]; then- - ' git push origin main:$branch'- - else- - ' git push -f origin remotes/origin/$branch:main'- - fi- - ''- - echo "Creating release in GitHub..."- - ''- - releaseId=$(curl -u robinshine:@secrets:github-token@ https://api.github.com/repos/theonedev/onedev/releases/tags/v@build_version@- | jq '.id')- - ''- - releaseJson="{\"name\":\"@build_version@\",\"tag_name\":\"v@build_version@\",\"body\":\"##- Online Demo\n\nhttps://code.onedev.io/projects?query=owned+by+%22demo%22\n\n##- Downloads\n\nhttps://code.onedev.io/projects/onedev-server/builds/@build_number@/artifacts\n\n##- Change Log\n\nhttps://code.onedev.io/projects/onedev-server/builds/@build_number@/fixed-issues?query=%22State%22+is+%22Released%22+order+by+%22Type%22+asc+and+%22Priority%22+desc\n\n##- Incompatibilities\n\nhttps://code.onedev.io/projects/onedev-server/builds/@build_number@/markdown-reports/Incompatibilities/doc/incompatibilities.md\"}"- - ''- - 'acceptHeader="Accept: application/vnd.github.v3+json"'- - if [ "$releaseId" == "null" ]; then- - ' curl -u robinshine:@secrets:github-token@ -X POST -H "$acceptHeader" -d "$releaseJson"- https://api.github.com/repos/theonedev/onedev/releases'- - else- - ' curl -u robinshine:@secrets:github-token@ -X PATCH -H "$acceptHeader" -d- "$releaseJson" https://api.github.com/repos/theonedev/onedev/releases/$releaseId'- - fi- condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL- - !PublishArtifactStep- name: 'publish artifact'- artifacts: '*.zip *.sh'- condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL- - !PublishMarkdownReportStep- name: 'publish markdown report'- reportName: Incompatibilities- filePatterns: doc/**- startPage: doc/incompatibilities.md- condition: ALWAYS- - !CloseMilestoneStep- name: 'close milestone'- milestoneName: '@build_version@'- condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL- jobDependencies:- - jobName: CI- requireSuccessful: true- retryCondition: never- maxRetries: 3- retryDelay: 30- cpuRequirement: 250m- memoryRequirement: 128m- caches:- - key: maven-cache- path: /root/.m2/repository- timeout: 3600-- name: Sync Main (GitHub)- steps:- - !CheckoutStep- name: 'checkout '- cloneCredential: !DefaultCredential {}- condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL- - !CommandStep- name: 'command '- image: alpine/git:1.0.7- commands:- - git config --global --unset http.extraHeader- - git push -f https://robinshine:@secrets:github-token@@@github.com/theonedev/server- HEAD:main- condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL- triggers:- - !BranchUpdateTrigger- branches: main- projects: onedev-server- retryCondition: never- maxRetries: 3- retryDelay: 30- cpuRequirement: 250m- memoryRequirement: 128m- timeout: 3600+version: 6+jobs:+- name: CI+ steps:+ - !CheckoutStep+ name: checkout+ cloneCredential: !DefaultCredential {}+ cloneDepth: 1+ condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL+ - !CommandStep+ name: detect build version+ image: 1dev/build-environment:1.3+ commands:+ - set -e+ - echo "Detecting project version (may require some time while downloading maven+ dependencies)..."+ - echo $(mvn org.apache.maven.plugins:maven-help-plugin:3.2.0:evaluate -Dexpression=project.version+ -q -DforceStdout) > buildVersion+ condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL+ - !SetBuildVersionStep+ name: set build version+ buildVersion: '@file:buildVersion@'+ condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL+ - !CommandStep+ name: test+ image: 1dev/build-environment:1.3+ commands:+ - mvn test+ condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL+ triggers:+ - !PullRequestUpdateTrigger {}+ - !BranchUpdateTrigger {}+ retryCondition: never+ maxRetries: 3+ retryDelay: 30+ cpuRequirement: 250m+ memoryRequirement: 128m+ caches:+ - key: maven-cache+ path: /root/.m2/repository+ timeout: 3600+- name: Release+ steps:+ - !CheckoutStep+ name: checkout+ cloneCredential: !HttpCredential+ accessTokenSecret: onedev-token+ condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL+ - !CommandStep+ name: 'detect build version '+ image: 1dev/build-environment:1.3+ commands:+ - set -e+ - echo "Detecting project version (may require some time while downloading maven+ dependencies)..."+ - echo $(mvn org.apache.maven.plugins:maven-help-plugin:3.1.0:evaluate -Dexpression=project.version+ -q -DforceStdout) > buildVersion+ condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL+ - !SetBuildVersionStep+ name: set build version+ buildVersion: '@file:buildVersion@'+ condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL+ - !CommandStep+ name: build & deploy+ image: 1dev/build-environment:1.3+ commands:+ - set -e+ - set -o pipefail+ - ''+ - projectDir=`pwd`+ - docker login -u robinshen -p @secrets:dockerhub-password@+ - ''+ - '# Skip test as we''ve already tested in CI build'+ - mvn -Dmaven.test.skip=true -Dmaven.deploy.password=@secrets:maven-deploy-password@+ deploy+ - ''+ - curl -u onedev:@secrets:maven-deploy-password@ -f -d @@/root/.m2/archetype-catalog.xml+ -X PUT "https://artifact.onedev.io/artifactory/onedev/archetype-catalog.xml"+ - ''+ - cd $projectDir/server-product/docker+ - ./build.sh+ - docker push 1dev/server:${buildVersion}+ - docker tag 1dev/server:${buildVersion} 1dev/server:latest+ - docker push 1dev/server:latest+ - ''+ - cd $projectDir/server-product/k8s+ - ./build.sh+ - ''+ - cd $projectDir+ - ''+ - cp server-product/target/k8s-resources.zip .+ - cp server-product/target/onedev-${buildVersion}.zip .+ - ''+ - cat << EOF > run-as-docker.sh+ - docker run -it --rm -v /var/run/docker.sock:/var/run/docker.sock -v \$(pwd)/onedev:/opt/onedev+ -p 6610:6610 -p 6611:6611 1dev/server:${buildVersion}+ - EOF+ - ''+ - echo "Creating release tag..."+ - git config --global user.name "Robin Shen"+ - git config --global user.email "robin@@onedev.io"+ - ''+ - git tag v@build_version@ -m "Release tag"+ - git push -f origin v@build_version@:v@build_version@+ - git config --global --unset http.extraHeader+ - git push -f https://robin:@secrets:github-token@@@github.com/theonedev/onedev+ v@build_version@:v@build_version@+ - ''+ - echo "Creating release branch in onedev-manual..."+ - ''+ - cd /onedev-build+ - branch=${buildVersion%.*}+ - git clone https://robin:@secrets:onedev-token@@@code.onedev.io/onedev-manual+ - cd onedev-manual+ - if [ "$(git branch -a|grep -c /$branch$)" -eq 0 ]; then+ - ' git push origin main:$branch'+ - else+ - ' git push -f origin remotes/origin/$branch:main'+ - fi+ - ''+ - echo "Creating release in GitHub..."+ - ''+ - releaseId=$(curl -u robinshine:@secrets:github-token@ https://api.github.com/repos/theonedev/onedev/releases/tags/v@build_version@+ | jq '.id')+ - ''+ - releaseJson="{\"name\":\"@build_version@\",\"tag_name\":\"v@build_version@\",\"body\":\"##+ Online Demo\n\nhttps://code.onedev.io/projects?query=owned+by+%22demo%22\n\n##+ Downloads\n\nhttps://code.onedev.io/projects/onedev-server/builds/@build_number@/artifacts\n\n##+ Change Log\n\nhttps://code.onedev.io/projects/onedev-server/builds/@build_number@/fixed-issues?query=%22State%22+is+%22Released%22+order+by+%22Type%22+asc+and+%22Priority%22+desc\n\n##+ Incompatibilities\n\nhttps://code.onedev.io/projects/onedev-server/builds/@build_number@/markdown-reports/Incompatibilities/doc/incompatibilities.md\"}"+ - ''+ - 'acceptHeader="Accept: application/vnd.github.v3+json"'+ - if [ "$releaseId" == "null" ]; then+ - ' curl -u robinshine:@secrets:github-token@ -X POST -H "$acceptHeader" -d "$releaseJson"+ https://api.github.com/repos/theonedev/onedev/releases'+ - else+ - ' curl -u robinshine:@secrets:github-token@ -X PATCH -H "$acceptHeader" -d+ "$releaseJson" https://api.github.com/repos/theonedev/onedev/releases/$releaseId'+ - fi+ condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL+ - !PublishArtifactStep+ name: publish artifact+ artifacts: '*.zip *.sh'+ condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL+ - !PublishMarkdownReportStep+ name: publish markdown report+ reportName: Incompatibilities+ filePatterns: doc/**+ startPage: doc/incompatibilities.md+ condition: ALWAYS+ - !CloseMilestoneStep+ name: close milestone+ milestoneName: '@build_version@'+ condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL+ jobDependencies:+ - jobName: CI+ requireSuccessful: true+ retryCondition: never+ maxRetries: 3+ retryDelay: 30+ cpuRequirement: 250m+ memoryRequirement: 128m+ caches:+ - key: maven-cache+ path: /root/.m2/repository+ timeout: 3600+- name: Sync Main (GitHub)+ steps:+ - !CheckoutStep+ name: 'checkout '+ cloneCredential: !DefaultCredential {}+ condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL+ - !CommandStep+ name: 'command '+ image: alpine/git:1.0.7+ commands:+ - git config --global --unset http.extraHeader+ - git push -f https://robinshine:@secrets:github-token@@@github.com/theonedev/server+ HEAD:main+ condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL+ triggers:+ - !BranchUpdateTrigger+ branches: main+ projects: onedev-server+ retryCondition: never+ maxRetries: 3+ retryDelay: 30+ cpuRequirement: 250m+ memoryRequirement: 128m+ timeout: 3600