fix: set SSH remote in CI
ci/woodpecker/push/woodpecker Pipeline failed
Details
ci/woodpecker/push/woodpecker Pipeline failed
Details
parent
023cd1dcc3
commit
4919f78d10
|
@ -8,4 +8,4 @@ pipeline:
|
||||||
- make
|
- make
|
||||||
- ls -lah && find scripts && cat scripts/ci.sh
|
- ls -lah && find scripts && cat scripts/ci.sh
|
||||||
- make ci-deploy
|
- make ci-deploy
|
||||||
secrets: [ pages_deploy_secret, hostea_write_deploy_key]
|
secrets: [ pages_deploy_secret, hostea_write_deploy_key ]
|
||||||
|
|
|
@ -15,10 +15,11 @@
|
||||||
# You should have received a copy of the GNU Affero General Public License
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
set -xEeuo pipefail
|
set -xEeuo pipefail
|
||||||
#source $(pwd)/scripts/lib.sh
|
#source $(pwd)/scripts/lib.sh
|
||||||
|
|
||||||
readonly SSH_ID_FILE=/tmp/ci-ssh-id
|
readonly SSH_ID_FILE=/tmp/ci-ssh-id
|
||||||
|
readonly SSH_REMOTE_NAME=origin-ssh
|
||||||
|
|
||||||
match_arg() {
|
match_arg() {
|
||||||
if [ $1 == $2 ] || [ $1 == $3 ]
|
if [ $1 == $2 ] || [ $1 == $3 ]
|
||||||
|
@ -48,6 +49,15 @@ write_ssh(){
|
||||||
echo $1 > $SSH_ID_FILE
|
echo $1 > $SSH_ID_FILE
|
||||||
}
|
}
|
||||||
|
|
||||||
|
set_ssh_remote() {
|
||||||
|
http_remote_url=$(git remote get-url origin)
|
||||||
|
remote_hostname=$(echo $http_remote_url | cut -d '/' -f 3)
|
||||||
|
repository_owner=$(echo $http_remote_url | cut -d '/' -f 4)
|
||||||
|
repository_name=$(echo $http_remote_url | cut -d '/' -f 5)
|
||||||
|
ssh_remote="git@$remote_hostname:$repository_owner/$repository_name"
|
||||||
|
git remote add $SSH_REMOTE_NAME $ssh_remote || true
|
||||||
|
}
|
||||||
|
|
||||||
clean() {
|
clean() {
|
||||||
if [ -f $SSH_ID_FILE ]
|
if [ -f $SSH_ID_FILE ]
|
||||||
then
|
then
|
||||||
|
@ -63,7 +73,7 @@ deploy() {
|
||||||
then
|
then
|
||||||
help
|
help
|
||||||
else
|
else
|
||||||
git -c core.sshCommand="/usr/bin/ssh -i $SSH_ID_FILE" push origin $2
|
git -c core.sshCommand="/usr/bin/ssh -i $SSH_ID_FILE" push $SSH_REMOTE_NAME $2
|
||||||
curl -vv --location --request \
|
curl -vv --location --request \
|
||||||
POST "https://hostea.org:5000/api/v1/update"\
|
POST "https://hostea.org:5000/api/v1/update"\
|
||||||
--header 'Content-Type: application/json' \
|
--header 'Content-Type: application/json' \
|
||||||
|
@ -87,6 +97,7 @@ then
|
||||||
help
|
help
|
||||||
exit -1
|
exit -1
|
||||||
fi
|
fi
|
||||||
|
set_ssh_remote
|
||||||
write_ssh $2
|
write_ssh $2
|
||||||
elif match_arg $1 '-c' '--clean'
|
elif match_arg $1 '-c' '--clean'
|
||||||
then
|
then
|
||||||
|
|
Loading…
Reference in New Issue