Compare commits
24 Commits
0.0.1.post
...
1.0.1
| Author | SHA1 | Date | |
|---|---|---|---|
| 794e54c88b | |||
|
|
e226f16292 | ||
|
|
8ea6b43a73 | ||
|
|
cb213df6b6 | ||
|
|
2c87f5488d | ||
| 078f5624b2 | |||
|
|
348204abb5 | ||
| 44c10b88a5 | |||
|
|
48114149fb | ||
| a4b7b27a65 | |||
|
|
5eb2f1c5cf | ||
|
|
65927077aa | ||
| 77e2be2714 | |||
|
|
0c02512814 | ||
| f422b9ff7d | |||
| 660270d49b | |||
| 9f442a7b8e | |||
| 8fb9ba8406 | |||
| 38abaa58c5 | |||
| 35d75ea019 | |||
| 0b8651a30a | |||
| c5b3055bfe | |||
| 92a1d1a30f | |||
| f2c0bf1ddd |
65
Jenkinsfile
vendored
65
Jenkinsfile
vendored
@@ -120,7 +120,7 @@ pipeline {
|
||||
echo("_GITEA_BASE_URL: . . . . . . . . $_GITEA_BASE_URL")
|
||||
echo("GIT_COMMIT:. . . . . . . . . . . $GIT_COMMIT ")
|
||||
echo("_PROJECT_USER_NAME:. . . . . . . $_PROJECT_USER_NAME")
|
||||
echo("_GITEA_PROJECT_NAME: . . . . . . $_PROJECT_NAME")
|
||||
echo("_PROJECT_NAME: . . . . . . . . . $_PROJECT_NAME")
|
||||
echo("_MaintainerEmail:. . . . . . . . $_MaintainerEmail")
|
||||
echo("_MaintainerName:. . . . . . . . $_MaintainerName")
|
||||
|
||||
@@ -135,19 +135,45 @@ pipeline {
|
||||
|
||||
sh("git config --global user.email $_MaintainerEmail")
|
||||
sh("git config --global user.name $_MaintainerName")
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
stage("GetCode") {
|
||||
steps {
|
||||
dir("gitrepo") {
|
||||
// manually checkout the repository, with All branches and tags
|
||||
// manually checkout the repository, with All branches and tags
|
||||
// => because we might need them for version and changelog computing
|
||||
checkout([ $class: "GitSCM",
|
||||
branches: [[name: GIT_BRANCH]],
|
||||
extensions: [[$class: "CloneOption", noTags: false, shallow: false, depth: 0, reference: '']],
|
||||
userRemoteConfigs: [[credentialsId: _SCMCredentials, url: GIT_URL]]])
|
||||
script{
|
||||
|
||||
withCredentials([usernamePassword(credentialsId: _SCMCredentials, passwordVariable: 'GIT_PASSWORD', usernameVariable: 'GIT_USERNAME')]) {
|
||||
sh("git remote set-url origin https://${GIT_USERNAME}:${GIT_PASSWORD}@chacha.ddns.net/gitea/${_PROJECT_USER_NAME}/${_PROJECT_NAME}.git")
|
||||
}
|
||||
|
||||
// using git to get the latest tag on this branch (before processing)
|
||||
def latestTag_beforeProcessing = sh(returnStdout: true, script: "git tag --sort=-creatordate | head -n 1").trim()
|
||||
echo("latestTag_beforeProcessing:. . . . . . . . . . . . $latestTag_beforeProcessing")
|
||||
|
||||
sh(script: """#!/bin/sh -
|
||||
|. ~/TOOLS_ENV/bin/activate
|
||||
|exec python - << '__EOWRAPPER__'
|
||||
|
|
||||
|from pygitversionhelper import gitversionhelper
|
||||
|
|
||||
|print(f"most recent repository tag: {gitversionhelper.tag.getLastTag()}")
|
||||
|print(f"most recent repository tag: {gitversionhelper.tag.getLastTag(same_branch=True)}")
|
||||
|print(f"number of commit since last tag: {gitversionhelper.tag.getDistanceFromTag()}")
|
||||
|print(f"number of commit since last tag: {gitversionhelper.tag.getDistanceFromTag(same_branch=True)}")
|
||||
|print(f"most recent repository version: {gitversionhelper.version.getLastVersion(formated_output=True)}")
|
||||
|print(f'current repository version: {gitversionhelper.version.getCurrentVersion(formated_output=True,version_std="PEP440",bump_type="dev",bump_dev_strategy="post")}')
|
||||
|
|
||||
|__EOWRAPPER__
|
||||
""".stripMargin())
|
||||
|
||||
if(_GIT_BRANCH=="master")
|
||||
{
|
||||
if(sh(returnStdout: true, script: "git tag --points-at HEAD").trim().isEmpty())
|
||||
@@ -176,17 +202,14 @@ pipeline {
|
||||
else
|
||||
{
|
||||
echo "new-tag requested in commit message: $BUMPED_VERSION"
|
||||
|
||||
sh("git tag $BUMPED_VERSION")
|
||||
sh("git push origin master --tags")
|
||||
sh("git push origin --tags")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// using git to get the latest tag on this branch
|
||||
def latestTag = sh(returnStdout: true, script: "git tag --sort=-creatordate | head -n 1").trim()
|
||||
echo("latestTag:. . . . . . . . . . . . $latestTag ")
|
||||
|
||||
sh(script: """#!/bin/sh -
|
||||
|
||||
sh(script: """#!/bin/sh -
|
||||
|. ~/TOOLS_ENV/bin/activate
|
||||
|exec python - << '__EOWRAPPER__'
|
||||
|
|
||||
@@ -201,7 +224,20 @@ pipeline {
|
||||
|
|
||||
|__EOWRAPPER__
|
||||
""".stripMargin())
|
||||
|
||||
|
||||
latestTag = sh(script: """#!/bin/sh -
|
||||
|. ~/TOOLS_ENV/bin/activate
|
||||
|exec python - << '__EOWRAPPER__'
|
||||
|
|
||||
|from pygitversionhelper import gitversionhelper
|
||||
|
|
||||
|print(gitversionhelper.tag.getLastTag(same_branch=True),end ="")
|
||||
|
|
||||
|__EOWRAPPER__
|
||||
""".stripMargin(),
|
||||
returnStdout: true)
|
||||
echo("latestTag:. . . . . . . . . . . . $latestTag ")
|
||||
|
||||
// get current (or bumped) version number from git history
|
||||
PY_PROJECT_VERSION = sh(script: """#!/bin/sh -
|
||||
|. ~/TOOLS_ENV/bin/activate
|
||||
@@ -217,11 +253,18 @@ pipeline {
|
||||
echo("PY_PROJECT_VERSION: . . . . . . . . . $PY_PROJECT_VERSION")
|
||||
PY_PROJECT_VERSION_STRIPPED=ExtractBaseVersion(PY_PROJECT_VERSION)
|
||||
|
||||
// Manually pushing a new tag with version string guessed by gitversionhelper
|
||||
// because setuptools-git-versioning cant fing tag on other branches, so will guess a wring version without this tag.
|
||||
if(latestTag!=PY_PROJECT_VERSION)
|
||||
{
|
||||
sh("git tag $PY_PROJECT_VERSION")
|
||||
sh("git push origin --tags")
|
||||
}
|
||||
|
||||
// specific handling to test the template itself
|
||||
// => little hacky... creating a new git repo with a commit/tag corresponding to HEAD of the official one
|
||||
if(_PROJECT_NAME=="pyChaChaDummyProject") //specific case to test the template itself
|
||||
{
|
||||
|
||||
sh("rm -Rf ~/_gitrepo || true")
|
||||
|
||||
sh(script: """#!/bin/sh -
|
||||
|
||||
Reference in New Issue
Block a user