-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #131 from Native-Planet/dev
v1.0.8
- Loading branch information
Showing
7 changed files
with
87 additions
and
25 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 |
---|---|---|
@@ -1,41 +1,89 @@ | ||
pipeline { | ||
agent any | ||
environment { | ||
environ = sh ( | ||
tag = sh ( | ||
script: ''' | ||
echo $BRANCH_NAME|sed 's@origin/@@g' | ||
environ=`echo $BRANCH_NAME|sed 's@origin/@@g'` | ||
if [ "${environ}" = "master" ]; then | ||
echo "latest" | ||
elif [ "${environ}" = "dev" ]; then | ||
echo "edge" | ||
else | ||
echo "nobuild" | ||
fi | ||
''', | ||
returnStdout: true | ||
).trim() | ||
} | ||
stages { | ||
stage('Build') { | ||
environment { | ||
tag = sh ( | ||
script: ''' | ||
if [ "${environ}" = "main" ]; then | ||
echo "latest" | ||
elif [ "${environ}" = "edge" ]; then | ||
echo "edge" | ||
else | ||
echo "nobuild" | ||
fi | ||
''', | ||
returnStdout: true | ||
).trim() | ||
stage('amd64build') { | ||
steps { | ||
script { | ||
if( "${tag}" != "nobuild" ) { | ||
sh ''' | ||
echo "debug: building amd64" | ||
mkdir -p /opt/groundseg/version/bin | ||
cd ./build-scripts | ||
docker build --tag nativeplanet/groundseg-builder:3.10.9 . | ||
cd .. | ||
rm -rf /var/jenkins_home/tmp | ||
mkdir -p /var/jenkins_home/tmp | ||
cp -r api /var/jenkins_home/tmp | ||
docker run -v /home/np/np-cicd/jenkins_conf/tmp/binary:/binary -v /home/np/np-cicd/jenkins_conf/tmp/api:/api nativeplanet/groundseg-builder:3.10.9 | ||
chmod +x /var/jenkins_home/tmp/binary/groundseg | ||
mv /var/jenkins_home/tmp/binary/groundseg /opt/groundseg/version/bin/groundseg_amd64_${tag} | ||
''' | ||
} | ||
} | ||
} | ||
} | ||
stage('arm64build') { | ||
agent { node { label 'arm' } } | ||
steps { | ||
script { | ||
if( "${tag}" != "nobuild" ) { | ||
sh ''' | ||
echo "debug: building arm64" | ||
cd build-scripts | ||
docker build --tag nativeplanet/groundseg-builder:3.10.9 . | ||
cd .. | ||
docker run -v "$(pwd)/binary":/binary -v "$(pwd)/api":/api nativeplanet/groundseg-builder:3.10.9 | ||
cd ui | ||
docker buildx build --push --tag nativeplanet/groundseg-webui:${tag} --platform linux/amd64,linux/arm64 . | ||
''' | ||
stash includes: 'binary/groundseg', name: 'groundseg_arm64' | ||
} | ||
} | ||
} | ||
} | ||
stage('postbuild') { | ||
steps { | ||
script { | ||
if( "${tag}" != "nobuild" ){ | ||
sh 'echo "debug: post-build actions"' | ||
dir('/opt/groundseg/version/bin/'){ | ||
unstash 'groundseg_arm64' | ||
} | ||
sh 'mv /opt/groundseg/version/bin/binary/groundseg /opt/groundseg/version/bin/groundseg_arm64_${tag}' | ||
sh 'rm -rf /opt/groundseg/version/bin/binary/' | ||
} | ||
if( "${tag}" == "latest" ) { | ||
sh 'mv ./release/version.csv /opt/groundseg/version/' | ||
sh 'mv ./release/standard_install.sh /opt/groundseg/get/install.sh' | ||
sh 'mv ./release/groundseg_install.sh /opt/groundseg/get/only.sh' | ||
sh ''' | ||
mv ./release/version.csv /opt/groundseg/version/ | ||
mv ./release/standard_install.sh /opt/groundseg/get/install.sh | ||
mv ./release/groundseg_install.sh /opt/groundseg/get/only.sh | ||
''' | ||
} | ||
if( "${tag}" == "edge" ) { | ||
sh 'mv ./release/version_edge.csv /opt/groundseg/version/' | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
post { | ||
always { | ||
cleanWs deleteDirs: true, notFailBuild: true | ||
} | ||
} | ||
} |
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
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
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