,
change the first letter of the value of the variable to lowercase, ,,
change the value of the whole variable to lower case.
$ test='HELLO'
$ echo $test
HELLO
$ echo ${test,}
hELLO
$ echo ${test,,}
hello
$ test=${test,,}
$ echo ${test^}
Hello
$ echo ${test^^}
HELLO
#!/bin/bash
git push
currentbranch=`git branch --show-current`
if [ "${currentbranch}" == "local" ]; then
git checkout develop
git merge local
git push
elif [ "${currentbranch}" == "develop" ]; then
git checkout local
git merge develop
git push
fi
git checkout $currentbranch
Don't ask why I wrote this foolish script. I have to do it 😀
I originally thought the later should be used. I was wrong.
cat monitor.sh
#!/bin/bash
source /etc/profile
cd /home/koala/Vagrant/windows-server-2019
(echo > /dev/tcp/192.168.178.220/23) > /dev/null 2>&1
if [ $? -ne 0 ]; then
vagrant halt
vagrant up
fi
-
Checkout code
-
Set correct config file
-
Scp to the remote machine
-
Run deploy.sh on the remote machine by ssh
- docker-compose build --no-cache
- docker-compose down
- docker-compose up -d
sshPublisher setup
- Manage Jenkins -> Config System
- Find Publish over SSH
- Add New Server, test connection
- Write directive in Jenkins file
sshPublisher(
continueOnError: false, failOnError: true,
publishers: [
sshPublisherDesc(
configName: "yt-files-${BRANCH}",
verbose: true,
transfers: [
sshTransfer(
sourceFiles: "**/**",
remoteDirectory: "./publish/${BRANCH}",
removePrefix: '',
remoteDirectorySDF: false,
cleanRemote: true,
execCommand: "cd ./publish/${BRANCH} && bash deploy.sh ${BRANCH}"
)
])
]
)
要在Jenkins中新增对一个仓库的发布,需要以下步骤
-
创建流水线, 添加Git仓库,Credentials
-
为各分支添加必要的配置文件(不方便加入版本控制的机密信息)
-
写 Jenkinsfile