-
Notifications
You must be signed in to change notification settings - Fork 81
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: changed the jenkins file to leave the repo clean
- Loading branch information
1 parent
82ee9da
commit b5d39ca
Showing
5 changed files
with
58 additions
and
19 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 |
---|---|---|
|
@@ -44,14 +44,14 @@ pipeline { | |
sh(""" | ||
if git rev-parse --git-dir > /dev/null 2>&1; then | ||
echo "The repo is already cloned" | ||
git reset --hard HEAD | ||
git checkout .; | ||
git fetch; | ||
git clean -fd; | ||
git reset --hard origin/${params.releaseBranch}; | ||
git fetch origin | ||
git checkout master | ||
git reset --hard origin/master | ||
./jenkins/reset-repo.sh ./ | ||
git checkout -t origin/${params.releaseBranch} | ||
else | ||
git config --global user.email "[email protected] | ||
git config --global user.name "Jenkins jenkinovici | ||
git config --global user.name "Jenkins Jenkinovici | ||
git clone [email protected]:ThemeFuse/Brizy.git ./ | ||
fi | ||
""") | ||
|
@@ -147,13 +147,21 @@ pipeline { | |
sh "rm '${zipFilePath}'" | ||
sh "rm *.zip" | ||
} | ||
|
||
failure{ | ||
discordSend title: JOB_NAME, footer: discordFooter, link: env.BUILD_URL, result: currentBuild.currentResult, description: "Changelog: \n ${changelog}", webhookURL: env.DISCORD_WEBHOOK_URL | ||
} | ||
|
||
aborted{ | ||
discordSend title: JOB_NAME, footer: discordFooter, link: env.BUILD_URL, result: currentBuild.currentResult, description: "Changelog: \n ${changelog}", webhookURL: env.DISCORD_WEBHOOK_URL | ||
} | ||
|
||
always { | ||
|
||
sshagent (credentials: ['ssh_with_passphrase_provided']) { | ||
sh "./jenkins/reset-repo.sh ./" | ||
} | ||
} | ||
} | ||
} | ||
|
||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/usr/bin/env bash | ||
|
||
REPO_PATH=$1 | ||
REPO_BRANCH=$2 | ||
|
||
|
||
cd $REPO_PATH | ||
|
||
# fetch all changes | ||
git fetch origin | ||
|
||
# unstage all files | ||
git reset | ||
git clean -fd | ||
|
||
# reset all local branches to original state | ||
git checkout develop | ||
git reset --hard origin/develop | ||
|
||
git checkout master | ||
git reset --hard origin/master | ||
|
||
# delete all local branches except for master/main and develop | ||
if [[ $(git branch | grep -v "master$\|develop$") ]]; then | ||
git branch | grep -v "master$\|develop$" | xargs git branch -D | ||
fi |