-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
129 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
node { | ||
def gitHubBaseAddress = "github.com" | ||
def hcBuildDir = "/var/lib/jenkins/workspace/hypercloud-api-server-golang" | ||
def imageBuildHome = "${hcBuildDir}" | ||
|
||
def scriptHome = "${hcBuildDir}/scripts" | ||
|
||
def gitHcAddress = "${gitHubBaseAddress}/tmax-cloud/hypercloud-api-server.git" | ||
|
||
def version = "${params.majorVersion}.${params.minorVersion}.${params.tinyVersion}.${params.hotfixVersion}" | ||
def preVersion = "${params.preVersion}" | ||
|
||
def imageTag = "b${version}" | ||
|
||
def userName = "taegeon_woo" | ||
def userEmail = "[email protected]" | ||
|
||
stage('git pull & Go build') { | ||
dir(imageBuildHome){ | ||
// git pull | ||
sh "git checkout ${params.buildBranch}" | ||
sh "git config --global user.name ${userName}" | ||
sh "git config --global user.email ${userEmail}" | ||
sh "git config --global credential.helper store" | ||
|
||
sh "git fetch --all" | ||
sh "git reset --hard origin/${params.buildBranch}" | ||
sh "git pull origin ${params.buildBranch}" | ||
|
||
//go build | ||
sh "go build main.go" | ||
} | ||
} | ||
|
||
stage('image build & push'){ | ||
dir(imageBuildHome){ | ||
sh "sudo docker build --tag tmaxcloudck/hypercloud-api-server:${imageTag} ." | ||
sh "sudo docker push tmaxcloudck/hypercloud-api-server:${imageTag}" | ||
} | ||
} | ||
|
||
stage('make change log'){ | ||
sh "sudo sh ${scriptHome}/hypercloud-changelog.sh ${version} ${preVersion}" | ||
} | ||
|
||
|
||
stage('git push'){ | ||
dir ("${imageBuildHome}") { | ||
sh "git checkout ${params.buildBranch}" | ||
|
||
sh "git config --global user.name ${userName}" | ||
sh "git config --global user.email ${userEmail}" | ||
sh "git config --global credential.helper store" | ||
sh "git add -A" | ||
|
||
sh (script:'git commit -m "[Distribution] Hypercloud-api-server- ${version} " || true') | ||
sh "git tag v${version}" | ||
|
||
sh "sudo git push -u origin +${params.buildBranch}" | ||
sh "sudo git push origin v${version}" | ||
|
||
sh "git fetch --all" | ||
sh "git reset --hard origin/${params.buildBranch}" | ||
sh "git pull origin ${params.buildBranch}" | ||
} | ||
} | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
#!/bin/bash | ||
# by taegeon_woo | ||
|
||
# destination file | ||
output=CHANGELOG.md | ||
timestamp=`date` | ||
version=$1 | ||
prev_version=$2 | ||
|
||
if [ -z $version ]; then | ||
version=4.0.0.x | ||
fi | ||
|
||
if [ -z $prev_version ]; then | ||
prev_version=4.0.0.0 | ||
fi | ||
|
||
backup="CHANGELOG_$prev_version.md" | ||
if [ -f $output ]; then | ||
echo "!!!changelog file exist" | ||
mv $output $backup | ||
fi | ||
|
||
echo "workdir: `pwd`" | ||
echo "!!!make changelog for $version" | ||
echo "!!!prev version: $prev_version" | ||
|
||
# gen file | ||
echo "# Hypercloud-api-server changelog!!" > $output | ||
echo "All notable changes to this project will be documented in this file." >> $output | ||
|
||
echo -e "\n<!-------------------- v$version start -------------------->" >> $output | ||
echo -e "\n## Hypercloud-api-server $version ($timestamp)" >> $output | ||
|
||
# make commit log to changelog | ||
echo -e "\n### Added" >> $output | ||
git log v$prev_version..HEAD --no-merges --oneline --format=" - %s by %cN" --grep="^\[feat\].*" -i >> $output | ||
#git log v$prev_version..HEAD --no-merges --oneline --format=" - %s by %cN" >> $output | ||
|
||
echo -e "\n### Changed" >> $output | ||
git log v$prev_version..HEAD --no-merges --oneline --format=" - %s by %cN" --grep="^\[mod\].*" -i >> $output | ||
|
||
echo -e "\n### Fixed" >> $output | ||
git log v$prev_version..HEAD --no-merges --oneline --format=" - %s by %cN" --grep="^\[ims\]\[[0-9]*\].*" -i >> $output | ||
|
||
echo -e "\n### CRD yaml" >> $output | ||
git log v$prev_version..HEAD --no-merges --oneline --format=" - %s by %cN" --grep="^\[crd\].*" -i >> $output | ||
|
||
echo -e "\n### Etc" >> $output | ||
git log v$prev_version..HEAD --no-merges --oneline --format=" - %s by %cN" --grep="^\[etc\].*" -i >> $output | ||
|
||
if [ -f $backup ]; then | ||
echo "!!!add previous changelog" | ||
sed '1,2d' $backup >> $output | ||
rm $backup | ||
fi | ||
|
||
echo "!!!done" |