Jenkins: hudson.plugins.git.GitException: Command "git fetch --tags --progress origin returned status code 143:









up vote
2
down vote

favorite
1












I haven't been able to build a job in Jenkins because I get the "status code 143:" error in the Build log. According to this jenkins bug page, the error has to do with the repo taking longer than 10 minutes to fetch. So, as a solution, I changed some of the options for faster fetching, which are: uncheck "Fetch Tags", check "Shallow clone" and "Shallow clone depth" set to 1 and "Timeout (in minutes for clone and fetch operations" set to 20.



I'm attaching my configuration here



This is the build log from Jenkins:



This is my Jenkinsfile inside of the repo which I don't think jenkins hasn't been able to get to that point because of the timeout set to 10 minutes, which I can't change:



// Deployment template for CMS-based websites (Drupal or Wordpress)
//
//
pipeline
agent any

parameters
choice(choices: "DevnStagingnProduction", description: "Choose which environment to push changes to.", name: "DEPLOY_TO")
choice choices: "NonYes", description: "Choose whether to deploy the database as well.", name: "DEPLOY_DB"


environment
SITEID = "ge"
NOFLAGS = "0"
DBNAME = "wpress_website"
DBSERVER = "dbserver"
DBUSER = "geWordpress"
DBPASS = "akjh23kas"
EXCLUDE = "comp_commentmeta,comp_comments" // separate multiple tables with commas
DEPLOY_TO = "$params.DEPLOY_TO"
DEPLOY_DB = "$params.DEPLOY_DB"


stages
stage("deploy-db-dev")
when
allOf
environment ignoreCase: true, name: "DEPLOY_TO", value: "dev";
environment ignoreCase: true, name: "DEPLOY_DB", value: "yes";


steps
// this stage only required until we make our dev the master DB
// copy full dev database from appserv1
// import latest database dump to dev server
script head -1', returnStdout: true)

//Fixing the problem with the collation existing in the sql dump file, refer to: https://stackoverflow.com/questions/42385099/1273-unknown-collation-utf8mb4-unicode-520-ci
//apparently, this is due to a version of mysql issue. Once the problem is fixed from the server side we can then remove the following lines.

sh "sed -i s/utf8mb4_unicode_520_ci/utf8mb4_unicode_ci/g $FILENM"
//The following line was added because the site is pointing to a staging server which we don't have control over, again, once this is fixed we can delete the following line of code.
sh "sed -i s/edit.staging.websites.3pth.com/stage.goewpfoods.hcgweb.net/g $FILENM"

sh "mysql -h appserver -u $env.DBUSER --password='$env.DBPASS' $env.DBNAME_dev < $WORKSPACE/$FILENM"


stage("deploy-dev")
when
environment ignoreCase: true, name: "DEPLOY_TO", value: "dev"

steps
// copy files to appserv2
// NOTE: if we move the repo to SVN, we should change httpdocs/ to $env.SITEIDdocs/
sh "sudo chown jenkins:jenkins *"

//Replace the wp-config.php file with our comp file with our information.
sh "/bin/cp httpdocs/wp-config-comp.php httpdocs/wp-config.php"

// prepare the dev server to receive files by changing the owner
sh "ssh webadmin@appserv2 "sudo chown -R webadmin:webadmin /var/opt/httpd/$env.SITEIDdocs/""
// copy files from control server to dev
sh "rsync --exclude=Jenkinsfile -rav -e ssh --delete $WORKSPACE/httpdocs/ webadmin@appserv2:/var/opt/httpd/$env.SITEIDdocs/"
// fix the owner/permissions on the dev server
sh "ssh webadmin@appserv2 "sudo chown -R apache:$env.SITEID-web /var/opt/httpd/$env.SITEIDdocs/""
sh "ssh webadmin@appserv2 "sudo chmod -R g+w /var/opt/httpd/$env.SITEIDdocs/""
sh "ssh webadmin@appserv2 "sudo find /var/opt/httpd/$env.SITEIDdocs/ -type d -exec chmod g+s \;""


stage("deploy-db-staging")
when
allOf
environment ignoreCase: true, name: "DEPLOY_TO", value: "staging";
environment ignoreCase: true, name: "DEPLOY_DB", value: "yes";


steps
script
def myexcludes = env.EXCLUDE.split(',').toList()
MYFLAGS = "-Q -K -c -e --default-character-set=utf8 "
if (env.NOFLAGS == "0")
myexcludes.each
MYFLAGS = "$MYFLAGS --ignore-table=$env.DBNAME_dev.$it"



sh "cd $WORKSPACE"
// pull a backup of the current dev database (may exclude some tables)
sh "mysqldump -h appserv2 -u $env.DBUSER --password='$env.DBPASS' $env.DBNAME_dev $MYFLAGS > $env.DBNAME_dev.sql"
// create a backup copy of the current staging database (full backup)
sh "mysqldump -h $env.DBSERVER -u $env.DBUSER --password='$env.DBPASS' $env.DBNAME_stage > $env.DBNAME_stage_bak.sql"
// upload the dev database dump to the staging database
sh "mysql -h $env.DBSERVER -u $env.DBUSER --password='$env.DBPASS' $env.DBNAME_stage < $WORKSPACE/$env.DBNAME_dev.sql"


stage("deploy-staging")
when
environment ignoreCase: true, name: "DEPLOY_TO", value: "staging"

steps
// copy files from dev to control server
sh "rsync --exclude=.svn --exclude=.git -rav -e ssh webadmin@appserv2:/var/opt/httpd/$env.SITEIDdocs/ /tmp/$env.SITEIDdocs/"

//Replace the wp-config.php file with our comp file with our information.
sh "/bin/cp httpdocs/wp-config-comp.php httpdocs/wp-config.php"

// prepare the staging server to receive files by changing the owner
sh "ssh webadmin@stageserv "sudo chown -R webadmin:webadmin /var/opt/httpd/$env.SITEIDdocs/""
// copy files from control server to staging
sh "rsync --exclude=.svn --exclude=.git -rav -e ssh --delete /tmp/$env.SITEIDdocs/ webadmin@stageserv:/var/opt/httpd/$env.SITEIDdocs/"
// fix the owner/permissions on the staging server
sh "ssh webadmin@stageserv "sudo chown -R apache:$env.SITEID-web /var/opt/httpd/$env.SITEIDdocs/""
sh "ssh webadmin@stageserv "sudo chmod -R g+w /var/opt/httpd/$env.SITEIDdocs/""
sh "ssh webadmin@stageserv "sudo find /var/opt/httpd/$env.SITEIDdocs/ -type d -exec chmod g+s \;""

// delete the temporary files on the control server
sh "rm -Rf /tmp/$env.SITEIDdocs/"
// clear the caches
sh "wget -O - "http://www.web.net/incacache.php?api_key=yoiVbjgtL&site_id=088""


stage("deploy-db-production")
when
allOf
environment ignoreCase: true, name: "DEPLOY_TO", value: "production";
environment ignoreCase: true, name: "DEPLOY_DB", value: "yes";


steps
script
def myexcludes = env.EXCLUDE.split(',').toList()
MYFLAGS = "-Q -K -c -e --default-character-set=utf8 "
if (env.NOFLAGS == "0")
myexcludes.each
MYFLAGS = "$MYFLAGS --ignore-table=$env.DBNAME_stage.$it"



sh "cd $WORKSPACE"
// pull a backup of the current staging database (may exclude some tables)
sh "mysqldump -h $env.DBSERVER -u $env.DBUSER --password='$env.DBPASS' $env.DBNAME_stage $MYFLAGS > $env.DBNAME_stage.sql"
// create a backup copy of the current production database (full backup)
sh "mysqldump -h $env.DBSERVER -u $env.DBUSER --password='$env.DBPASS' $env.DBNAME_prod > $env.DBNAME_prod_bak.sql"
// upload the staging database dump to the production database
sh "mysql -h $env.DBSERVER -u $env.DBUSER --password='$env.DBPASS' $env.DBNAME_prod < $WORKSPACE/$env.DBNAME_stage.sql"


stage("deploy-production")
when
environment ignoreCase: true, name: "DEPLOY_TO", value: "production"

steps
// copy files from staging to control server
sh "rsync --exclude=.svn --exclude=.git -rav -e ssh webadmin@stageserv:/var/opt/httpd/$env.SITEIDdocs/ /tmp/$env.SITEIDdocs/"

// prepare the production server to receive files by changing the owner
sh "ssh webadmin@appserv3 "sudo chown -R webadmin:webadmin /var/opt/httpd/$env.SITEIDdocs/""
sh "ssh webadmin@appserv4 "sudo chown -R webadmin:webadmin /var/opt/httpd/$env.SITEIDdocs/""
// copy files from control server to production
sh "rsync --exclude=.svn --exclude=.git -rav -e ssh --delete /tmp/$env.SITEIDdocs/ webadmin@appserv3:/var/opt/httpd/$env.SITEIDdocs/"
sh "rsync --exclude=.svn --exclude=.git -rav -e ssh --delete /tmp/$env.SITEIDdocs/ webadmin@appserv4:/var/opt/httpd/$env.SITEIDdocs/"
// fix the owner/permissions on the production server
sh "ssh webadmin@appserv3 "sudo chown -R apache:$env.SITEID-web /var/opt/httpd/$env.SITEIDdocs/""
sh "ssh webadmin@appserv4 "sudo chown -R apache:$env.SITEID-web /var/opt/httpd/$env.SITEIDdocs/""
sh "ssh webadmin@appserv3 "sudo chmod -R g+w /var/opt/httpd/$env.SITEIDdocs/""
sh "ssh webadmin@appserv4 "sudo chmod -R g+w /var/opt/httpd/$env.SITEIDdocs/""
sh "ssh webadmin@appserv3 "sudo find /var/opt/httpd/$env.SITEIDdocs/ -type d -exec chmod g+s \;""
sh "ssh webadmin@appserv4 "sudo find /var/opt/httpd/$env.SITEIDdocs/ -type d -exec chmod g+s \;""

// delete the temporary files on the control server
sh "rm -Rf /tmp/$env.SITEIDdocs/"
// clear the caches
sh "wget -O - "http://www.web.net/incacache.php?api_key=yoiVbjgtL&site_id=088""







Any help on this will be appreciated!










share|improve this question























  • The real problem is : Why does it takes more than 10 minutes to fetch ?
    – André DS
    Nov 8 at 21:12










  • @AndréDS is a big repo, around 3GB
    – VaTo
    Nov 9 at 0:00










  • Consider pasting your build log and Jenkinsfile right into this question. The links are dead.
    – Ken Rachynski
    Nov 9 at 18:10










  • @KenRachynski Thank you for pointing that out. I just updated the post with the right links.
    – VaTo
    Nov 9 at 19:46














up vote
2
down vote

favorite
1












I haven't been able to build a job in Jenkins because I get the "status code 143:" error in the Build log. According to this jenkins bug page, the error has to do with the repo taking longer than 10 minutes to fetch. So, as a solution, I changed some of the options for faster fetching, which are: uncheck "Fetch Tags", check "Shallow clone" and "Shallow clone depth" set to 1 and "Timeout (in minutes for clone and fetch operations" set to 20.



I'm attaching my configuration here



This is the build log from Jenkins:



This is my Jenkinsfile inside of the repo which I don't think jenkins hasn't been able to get to that point because of the timeout set to 10 minutes, which I can't change:



// Deployment template for CMS-based websites (Drupal or Wordpress)
//
//
pipeline
agent any

parameters
choice(choices: "DevnStagingnProduction", description: "Choose which environment to push changes to.", name: "DEPLOY_TO")
choice choices: "NonYes", description: "Choose whether to deploy the database as well.", name: "DEPLOY_DB"


environment
SITEID = "ge"
NOFLAGS = "0"
DBNAME = "wpress_website"
DBSERVER = "dbserver"
DBUSER = "geWordpress"
DBPASS = "akjh23kas"
EXCLUDE = "comp_commentmeta,comp_comments" // separate multiple tables with commas
DEPLOY_TO = "$params.DEPLOY_TO"
DEPLOY_DB = "$params.DEPLOY_DB"


stages
stage("deploy-db-dev")
when
allOf
environment ignoreCase: true, name: "DEPLOY_TO", value: "dev";
environment ignoreCase: true, name: "DEPLOY_DB", value: "yes";


steps
// this stage only required until we make our dev the master DB
// copy full dev database from appserv1
// import latest database dump to dev server
script head -1', returnStdout: true)

//Fixing the problem with the collation existing in the sql dump file, refer to: https://stackoverflow.com/questions/42385099/1273-unknown-collation-utf8mb4-unicode-520-ci
//apparently, this is due to a version of mysql issue. Once the problem is fixed from the server side we can then remove the following lines.

sh "sed -i s/utf8mb4_unicode_520_ci/utf8mb4_unicode_ci/g $FILENM"
//The following line was added because the site is pointing to a staging server which we don't have control over, again, once this is fixed we can delete the following line of code.
sh "sed -i s/edit.staging.websites.3pth.com/stage.goewpfoods.hcgweb.net/g $FILENM"

sh "mysql -h appserver -u $env.DBUSER --password='$env.DBPASS' $env.DBNAME_dev < $WORKSPACE/$FILENM"


stage("deploy-dev")
when
environment ignoreCase: true, name: "DEPLOY_TO", value: "dev"

steps
// copy files to appserv2
// NOTE: if we move the repo to SVN, we should change httpdocs/ to $env.SITEIDdocs/
sh "sudo chown jenkins:jenkins *"

//Replace the wp-config.php file with our comp file with our information.
sh "/bin/cp httpdocs/wp-config-comp.php httpdocs/wp-config.php"

// prepare the dev server to receive files by changing the owner
sh "ssh webadmin@appserv2 "sudo chown -R webadmin:webadmin /var/opt/httpd/$env.SITEIDdocs/""
// copy files from control server to dev
sh "rsync --exclude=Jenkinsfile -rav -e ssh --delete $WORKSPACE/httpdocs/ webadmin@appserv2:/var/opt/httpd/$env.SITEIDdocs/"
// fix the owner/permissions on the dev server
sh "ssh webadmin@appserv2 "sudo chown -R apache:$env.SITEID-web /var/opt/httpd/$env.SITEIDdocs/""
sh "ssh webadmin@appserv2 "sudo chmod -R g+w /var/opt/httpd/$env.SITEIDdocs/""
sh "ssh webadmin@appserv2 "sudo find /var/opt/httpd/$env.SITEIDdocs/ -type d -exec chmod g+s \;""


stage("deploy-db-staging")
when
allOf
environment ignoreCase: true, name: "DEPLOY_TO", value: "staging";
environment ignoreCase: true, name: "DEPLOY_DB", value: "yes";


steps
script
def myexcludes = env.EXCLUDE.split(',').toList()
MYFLAGS = "-Q -K -c -e --default-character-set=utf8 "
if (env.NOFLAGS == "0")
myexcludes.each
MYFLAGS = "$MYFLAGS --ignore-table=$env.DBNAME_dev.$it"



sh "cd $WORKSPACE"
// pull a backup of the current dev database (may exclude some tables)
sh "mysqldump -h appserv2 -u $env.DBUSER --password='$env.DBPASS' $env.DBNAME_dev $MYFLAGS > $env.DBNAME_dev.sql"
// create a backup copy of the current staging database (full backup)
sh "mysqldump -h $env.DBSERVER -u $env.DBUSER --password='$env.DBPASS' $env.DBNAME_stage > $env.DBNAME_stage_bak.sql"
// upload the dev database dump to the staging database
sh "mysql -h $env.DBSERVER -u $env.DBUSER --password='$env.DBPASS' $env.DBNAME_stage < $WORKSPACE/$env.DBNAME_dev.sql"


stage("deploy-staging")
when
environment ignoreCase: true, name: "DEPLOY_TO", value: "staging"

steps
// copy files from dev to control server
sh "rsync --exclude=.svn --exclude=.git -rav -e ssh webadmin@appserv2:/var/opt/httpd/$env.SITEIDdocs/ /tmp/$env.SITEIDdocs/"

//Replace the wp-config.php file with our comp file with our information.
sh "/bin/cp httpdocs/wp-config-comp.php httpdocs/wp-config.php"

// prepare the staging server to receive files by changing the owner
sh "ssh webadmin@stageserv "sudo chown -R webadmin:webadmin /var/opt/httpd/$env.SITEIDdocs/""
// copy files from control server to staging
sh "rsync --exclude=.svn --exclude=.git -rav -e ssh --delete /tmp/$env.SITEIDdocs/ webadmin@stageserv:/var/opt/httpd/$env.SITEIDdocs/"
// fix the owner/permissions on the staging server
sh "ssh webadmin@stageserv "sudo chown -R apache:$env.SITEID-web /var/opt/httpd/$env.SITEIDdocs/""
sh "ssh webadmin@stageserv "sudo chmod -R g+w /var/opt/httpd/$env.SITEIDdocs/""
sh "ssh webadmin@stageserv "sudo find /var/opt/httpd/$env.SITEIDdocs/ -type d -exec chmod g+s \;""

// delete the temporary files on the control server
sh "rm -Rf /tmp/$env.SITEIDdocs/"
// clear the caches
sh "wget -O - "http://www.web.net/incacache.php?api_key=yoiVbjgtL&site_id=088""


stage("deploy-db-production")
when
allOf
environment ignoreCase: true, name: "DEPLOY_TO", value: "production";
environment ignoreCase: true, name: "DEPLOY_DB", value: "yes";


steps
script
def myexcludes = env.EXCLUDE.split(',').toList()
MYFLAGS = "-Q -K -c -e --default-character-set=utf8 "
if (env.NOFLAGS == "0")
myexcludes.each
MYFLAGS = "$MYFLAGS --ignore-table=$env.DBNAME_stage.$it"



sh "cd $WORKSPACE"
// pull a backup of the current staging database (may exclude some tables)
sh "mysqldump -h $env.DBSERVER -u $env.DBUSER --password='$env.DBPASS' $env.DBNAME_stage $MYFLAGS > $env.DBNAME_stage.sql"
// create a backup copy of the current production database (full backup)
sh "mysqldump -h $env.DBSERVER -u $env.DBUSER --password='$env.DBPASS' $env.DBNAME_prod > $env.DBNAME_prod_bak.sql"
// upload the staging database dump to the production database
sh "mysql -h $env.DBSERVER -u $env.DBUSER --password='$env.DBPASS' $env.DBNAME_prod < $WORKSPACE/$env.DBNAME_stage.sql"


stage("deploy-production")
when
environment ignoreCase: true, name: "DEPLOY_TO", value: "production"

steps
// copy files from staging to control server
sh "rsync --exclude=.svn --exclude=.git -rav -e ssh webadmin@stageserv:/var/opt/httpd/$env.SITEIDdocs/ /tmp/$env.SITEIDdocs/"

// prepare the production server to receive files by changing the owner
sh "ssh webadmin@appserv3 "sudo chown -R webadmin:webadmin /var/opt/httpd/$env.SITEIDdocs/""
sh "ssh webadmin@appserv4 "sudo chown -R webadmin:webadmin /var/opt/httpd/$env.SITEIDdocs/""
// copy files from control server to production
sh "rsync --exclude=.svn --exclude=.git -rav -e ssh --delete /tmp/$env.SITEIDdocs/ webadmin@appserv3:/var/opt/httpd/$env.SITEIDdocs/"
sh "rsync --exclude=.svn --exclude=.git -rav -e ssh --delete /tmp/$env.SITEIDdocs/ webadmin@appserv4:/var/opt/httpd/$env.SITEIDdocs/"
// fix the owner/permissions on the production server
sh "ssh webadmin@appserv3 "sudo chown -R apache:$env.SITEID-web /var/opt/httpd/$env.SITEIDdocs/""
sh "ssh webadmin@appserv4 "sudo chown -R apache:$env.SITEID-web /var/opt/httpd/$env.SITEIDdocs/""
sh "ssh webadmin@appserv3 "sudo chmod -R g+w /var/opt/httpd/$env.SITEIDdocs/""
sh "ssh webadmin@appserv4 "sudo chmod -R g+w /var/opt/httpd/$env.SITEIDdocs/""
sh "ssh webadmin@appserv3 "sudo find /var/opt/httpd/$env.SITEIDdocs/ -type d -exec chmod g+s \;""
sh "ssh webadmin@appserv4 "sudo find /var/opt/httpd/$env.SITEIDdocs/ -type d -exec chmod g+s \;""

// delete the temporary files on the control server
sh "rm -Rf /tmp/$env.SITEIDdocs/"
// clear the caches
sh "wget -O - "http://www.web.net/incacache.php?api_key=yoiVbjgtL&site_id=088""







Any help on this will be appreciated!










share|improve this question























  • The real problem is : Why does it takes more than 10 minutes to fetch ?
    – André DS
    Nov 8 at 21:12










  • @AndréDS is a big repo, around 3GB
    – VaTo
    Nov 9 at 0:00










  • Consider pasting your build log and Jenkinsfile right into this question. The links are dead.
    – Ken Rachynski
    Nov 9 at 18:10










  • @KenRachynski Thank you for pointing that out. I just updated the post with the right links.
    – VaTo
    Nov 9 at 19:46












up vote
2
down vote

favorite
1









up vote
2
down vote

favorite
1






1





I haven't been able to build a job in Jenkins because I get the "status code 143:" error in the Build log. According to this jenkins bug page, the error has to do with the repo taking longer than 10 minutes to fetch. So, as a solution, I changed some of the options for faster fetching, which are: uncheck "Fetch Tags", check "Shallow clone" and "Shallow clone depth" set to 1 and "Timeout (in minutes for clone and fetch operations" set to 20.



I'm attaching my configuration here



This is the build log from Jenkins:



This is my Jenkinsfile inside of the repo which I don't think jenkins hasn't been able to get to that point because of the timeout set to 10 minutes, which I can't change:



// Deployment template for CMS-based websites (Drupal or Wordpress)
//
//
pipeline
agent any

parameters
choice(choices: "DevnStagingnProduction", description: "Choose which environment to push changes to.", name: "DEPLOY_TO")
choice choices: "NonYes", description: "Choose whether to deploy the database as well.", name: "DEPLOY_DB"


environment
SITEID = "ge"
NOFLAGS = "0"
DBNAME = "wpress_website"
DBSERVER = "dbserver"
DBUSER = "geWordpress"
DBPASS = "akjh23kas"
EXCLUDE = "comp_commentmeta,comp_comments" // separate multiple tables with commas
DEPLOY_TO = "$params.DEPLOY_TO"
DEPLOY_DB = "$params.DEPLOY_DB"


stages
stage("deploy-db-dev")
when
allOf
environment ignoreCase: true, name: "DEPLOY_TO", value: "dev";
environment ignoreCase: true, name: "DEPLOY_DB", value: "yes";


steps
// this stage only required until we make our dev the master DB
// copy full dev database from appserv1
// import latest database dump to dev server
script head -1', returnStdout: true)

//Fixing the problem with the collation existing in the sql dump file, refer to: https://stackoverflow.com/questions/42385099/1273-unknown-collation-utf8mb4-unicode-520-ci
//apparently, this is due to a version of mysql issue. Once the problem is fixed from the server side we can then remove the following lines.

sh "sed -i s/utf8mb4_unicode_520_ci/utf8mb4_unicode_ci/g $FILENM"
//The following line was added because the site is pointing to a staging server which we don't have control over, again, once this is fixed we can delete the following line of code.
sh "sed -i s/edit.staging.websites.3pth.com/stage.goewpfoods.hcgweb.net/g $FILENM"

sh "mysql -h appserver -u $env.DBUSER --password='$env.DBPASS' $env.DBNAME_dev < $WORKSPACE/$FILENM"


stage("deploy-dev")
when
environment ignoreCase: true, name: "DEPLOY_TO", value: "dev"

steps
// copy files to appserv2
// NOTE: if we move the repo to SVN, we should change httpdocs/ to $env.SITEIDdocs/
sh "sudo chown jenkins:jenkins *"

//Replace the wp-config.php file with our comp file with our information.
sh "/bin/cp httpdocs/wp-config-comp.php httpdocs/wp-config.php"

// prepare the dev server to receive files by changing the owner
sh "ssh webadmin@appserv2 "sudo chown -R webadmin:webadmin /var/opt/httpd/$env.SITEIDdocs/""
// copy files from control server to dev
sh "rsync --exclude=Jenkinsfile -rav -e ssh --delete $WORKSPACE/httpdocs/ webadmin@appserv2:/var/opt/httpd/$env.SITEIDdocs/"
// fix the owner/permissions on the dev server
sh "ssh webadmin@appserv2 "sudo chown -R apache:$env.SITEID-web /var/opt/httpd/$env.SITEIDdocs/""
sh "ssh webadmin@appserv2 "sudo chmod -R g+w /var/opt/httpd/$env.SITEIDdocs/""
sh "ssh webadmin@appserv2 "sudo find /var/opt/httpd/$env.SITEIDdocs/ -type d -exec chmod g+s \;""


stage("deploy-db-staging")
when
allOf
environment ignoreCase: true, name: "DEPLOY_TO", value: "staging";
environment ignoreCase: true, name: "DEPLOY_DB", value: "yes";


steps
script
def myexcludes = env.EXCLUDE.split(',').toList()
MYFLAGS = "-Q -K -c -e --default-character-set=utf8 "
if (env.NOFLAGS == "0")
myexcludes.each
MYFLAGS = "$MYFLAGS --ignore-table=$env.DBNAME_dev.$it"



sh "cd $WORKSPACE"
// pull a backup of the current dev database (may exclude some tables)
sh "mysqldump -h appserv2 -u $env.DBUSER --password='$env.DBPASS' $env.DBNAME_dev $MYFLAGS > $env.DBNAME_dev.sql"
// create a backup copy of the current staging database (full backup)
sh "mysqldump -h $env.DBSERVER -u $env.DBUSER --password='$env.DBPASS' $env.DBNAME_stage > $env.DBNAME_stage_bak.sql"
// upload the dev database dump to the staging database
sh "mysql -h $env.DBSERVER -u $env.DBUSER --password='$env.DBPASS' $env.DBNAME_stage < $WORKSPACE/$env.DBNAME_dev.sql"


stage("deploy-staging")
when
environment ignoreCase: true, name: "DEPLOY_TO", value: "staging"

steps
// copy files from dev to control server
sh "rsync --exclude=.svn --exclude=.git -rav -e ssh webadmin@appserv2:/var/opt/httpd/$env.SITEIDdocs/ /tmp/$env.SITEIDdocs/"

//Replace the wp-config.php file with our comp file with our information.
sh "/bin/cp httpdocs/wp-config-comp.php httpdocs/wp-config.php"

// prepare the staging server to receive files by changing the owner
sh "ssh webadmin@stageserv "sudo chown -R webadmin:webadmin /var/opt/httpd/$env.SITEIDdocs/""
// copy files from control server to staging
sh "rsync --exclude=.svn --exclude=.git -rav -e ssh --delete /tmp/$env.SITEIDdocs/ webadmin@stageserv:/var/opt/httpd/$env.SITEIDdocs/"
// fix the owner/permissions on the staging server
sh "ssh webadmin@stageserv "sudo chown -R apache:$env.SITEID-web /var/opt/httpd/$env.SITEIDdocs/""
sh "ssh webadmin@stageserv "sudo chmod -R g+w /var/opt/httpd/$env.SITEIDdocs/""
sh "ssh webadmin@stageserv "sudo find /var/opt/httpd/$env.SITEIDdocs/ -type d -exec chmod g+s \;""

// delete the temporary files on the control server
sh "rm -Rf /tmp/$env.SITEIDdocs/"
// clear the caches
sh "wget -O - "http://www.web.net/incacache.php?api_key=yoiVbjgtL&site_id=088""


stage("deploy-db-production")
when
allOf
environment ignoreCase: true, name: "DEPLOY_TO", value: "production";
environment ignoreCase: true, name: "DEPLOY_DB", value: "yes";


steps
script
def myexcludes = env.EXCLUDE.split(',').toList()
MYFLAGS = "-Q -K -c -e --default-character-set=utf8 "
if (env.NOFLAGS == "0")
myexcludes.each
MYFLAGS = "$MYFLAGS --ignore-table=$env.DBNAME_stage.$it"



sh "cd $WORKSPACE"
// pull a backup of the current staging database (may exclude some tables)
sh "mysqldump -h $env.DBSERVER -u $env.DBUSER --password='$env.DBPASS' $env.DBNAME_stage $MYFLAGS > $env.DBNAME_stage.sql"
// create a backup copy of the current production database (full backup)
sh "mysqldump -h $env.DBSERVER -u $env.DBUSER --password='$env.DBPASS' $env.DBNAME_prod > $env.DBNAME_prod_bak.sql"
// upload the staging database dump to the production database
sh "mysql -h $env.DBSERVER -u $env.DBUSER --password='$env.DBPASS' $env.DBNAME_prod < $WORKSPACE/$env.DBNAME_stage.sql"


stage("deploy-production")
when
environment ignoreCase: true, name: "DEPLOY_TO", value: "production"

steps
// copy files from staging to control server
sh "rsync --exclude=.svn --exclude=.git -rav -e ssh webadmin@stageserv:/var/opt/httpd/$env.SITEIDdocs/ /tmp/$env.SITEIDdocs/"

// prepare the production server to receive files by changing the owner
sh "ssh webadmin@appserv3 "sudo chown -R webadmin:webadmin /var/opt/httpd/$env.SITEIDdocs/""
sh "ssh webadmin@appserv4 "sudo chown -R webadmin:webadmin /var/opt/httpd/$env.SITEIDdocs/""
// copy files from control server to production
sh "rsync --exclude=.svn --exclude=.git -rav -e ssh --delete /tmp/$env.SITEIDdocs/ webadmin@appserv3:/var/opt/httpd/$env.SITEIDdocs/"
sh "rsync --exclude=.svn --exclude=.git -rav -e ssh --delete /tmp/$env.SITEIDdocs/ webadmin@appserv4:/var/opt/httpd/$env.SITEIDdocs/"
// fix the owner/permissions on the production server
sh "ssh webadmin@appserv3 "sudo chown -R apache:$env.SITEID-web /var/opt/httpd/$env.SITEIDdocs/""
sh "ssh webadmin@appserv4 "sudo chown -R apache:$env.SITEID-web /var/opt/httpd/$env.SITEIDdocs/""
sh "ssh webadmin@appserv3 "sudo chmod -R g+w /var/opt/httpd/$env.SITEIDdocs/""
sh "ssh webadmin@appserv4 "sudo chmod -R g+w /var/opt/httpd/$env.SITEIDdocs/""
sh "ssh webadmin@appserv3 "sudo find /var/opt/httpd/$env.SITEIDdocs/ -type d -exec chmod g+s \;""
sh "ssh webadmin@appserv4 "sudo find /var/opt/httpd/$env.SITEIDdocs/ -type d -exec chmod g+s \;""

// delete the temporary files on the control server
sh "rm -Rf /tmp/$env.SITEIDdocs/"
// clear the caches
sh "wget -O - "http://www.web.net/incacache.php?api_key=yoiVbjgtL&site_id=088""







Any help on this will be appreciated!










share|improve this question















I haven't been able to build a job in Jenkins because I get the "status code 143:" error in the Build log. According to this jenkins bug page, the error has to do with the repo taking longer than 10 minutes to fetch. So, as a solution, I changed some of the options for faster fetching, which are: uncheck "Fetch Tags", check "Shallow clone" and "Shallow clone depth" set to 1 and "Timeout (in minutes for clone and fetch operations" set to 20.



I'm attaching my configuration here



This is the build log from Jenkins:



This is my Jenkinsfile inside of the repo which I don't think jenkins hasn't been able to get to that point because of the timeout set to 10 minutes, which I can't change:



// Deployment template for CMS-based websites (Drupal or Wordpress)
//
//
pipeline
agent any

parameters
choice(choices: "DevnStagingnProduction", description: "Choose which environment to push changes to.", name: "DEPLOY_TO")
choice choices: "NonYes", description: "Choose whether to deploy the database as well.", name: "DEPLOY_DB"


environment
SITEID = "ge"
NOFLAGS = "0"
DBNAME = "wpress_website"
DBSERVER = "dbserver"
DBUSER = "geWordpress"
DBPASS = "akjh23kas"
EXCLUDE = "comp_commentmeta,comp_comments" // separate multiple tables with commas
DEPLOY_TO = "$params.DEPLOY_TO"
DEPLOY_DB = "$params.DEPLOY_DB"


stages
stage("deploy-db-dev")
when
allOf
environment ignoreCase: true, name: "DEPLOY_TO", value: "dev";
environment ignoreCase: true, name: "DEPLOY_DB", value: "yes";


steps
// this stage only required until we make our dev the master DB
// copy full dev database from appserv1
// import latest database dump to dev server
script head -1', returnStdout: true)

//Fixing the problem with the collation existing in the sql dump file, refer to: https://stackoverflow.com/questions/42385099/1273-unknown-collation-utf8mb4-unicode-520-ci
//apparently, this is due to a version of mysql issue. Once the problem is fixed from the server side we can then remove the following lines.

sh "sed -i s/utf8mb4_unicode_520_ci/utf8mb4_unicode_ci/g $FILENM"
//The following line was added because the site is pointing to a staging server which we don't have control over, again, once this is fixed we can delete the following line of code.
sh "sed -i s/edit.staging.websites.3pth.com/stage.goewpfoods.hcgweb.net/g $FILENM"

sh "mysql -h appserver -u $env.DBUSER --password='$env.DBPASS' $env.DBNAME_dev < $WORKSPACE/$FILENM"


stage("deploy-dev")
when
environment ignoreCase: true, name: "DEPLOY_TO", value: "dev"

steps
// copy files to appserv2
// NOTE: if we move the repo to SVN, we should change httpdocs/ to $env.SITEIDdocs/
sh "sudo chown jenkins:jenkins *"

//Replace the wp-config.php file with our comp file with our information.
sh "/bin/cp httpdocs/wp-config-comp.php httpdocs/wp-config.php"

// prepare the dev server to receive files by changing the owner
sh "ssh webadmin@appserv2 "sudo chown -R webadmin:webadmin /var/opt/httpd/$env.SITEIDdocs/""
// copy files from control server to dev
sh "rsync --exclude=Jenkinsfile -rav -e ssh --delete $WORKSPACE/httpdocs/ webadmin@appserv2:/var/opt/httpd/$env.SITEIDdocs/"
// fix the owner/permissions on the dev server
sh "ssh webadmin@appserv2 "sudo chown -R apache:$env.SITEID-web /var/opt/httpd/$env.SITEIDdocs/""
sh "ssh webadmin@appserv2 "sudo chmod -R g+w /var/opt/httpd/$env.SITEIDdocs/""
sh "ssh webadmin@appserv2 "sudo find /var/opt/httpd/$env.SITEIDdocs/ -type d -exec chmod g+s \;""


stage("deploy-db-staging")
when
allOf
environment ignoreCase: true, name: "DEPLOY_TO", value: "staging";
environment ignoreCase: true, name: "DEPLOY_DB", value: "yes";


steps
script
def myexcludes = env.EXCLUDE.split(',').toList()
MYFLAGS = "-Q -K -c -e --default-character-set=utf8 "
if (env.NOFLAGS == "0")
myexcludes.each
MYFLAGS = "$MYFLAGS --ignore-table=$env.DBNAME_dev.$it"



sh "cd $WORKSPACE"
// pull a backup of the current dev database (may exclude some tables)
sh "mysqldump -h appserv2 -u $env.DBUSER --password='$env.DBPASS' $env.DBNAME_dev $MYFLAGS > $env.DBNAME_dev.sql"
// create a backup copy of the current staging database (full backup)
sh "mysqldump -h $env.DBSERVER -u $env.DBUSER --password='$env.DBPASS' $env.DBNAME_stage > $env.DBNAME_stage_bak.sql"
// upload the dev database dump to the staging database
sh "mysql -h $env.DBSERVER -u $env.DBUSER --password='$env.DBPASS' $env.DBNAME_stage < $WORKSPACE/$env.DBNAME_dev.sql"


stage("deploy-staging")
when
environment ignoreCase: true, name: "DEPLOY_TO", value: "staging"

steps
// copy files from dev to control server
sh "rsync --exclude=.svn --exclude=.git -rav -e ssh webadmin@appserv2:/var/opt/httpd/$env.SITEIDdocs/ /tmp/$env.SITEIDdocs/"

//Replace the wp-config.php file with our comp file with our information.
sh "/bin/cp httpdocs/wp-config-comp.php httpdocs/wp-config.php"

// prepare the staging server to receive files by changing the owner
sh "ssh webadmin@stageserv "sudo chown -R webadmin:webadmin /var/opt/httpd/$env.SITEIDdocs/""
// copy files from control server to staging
sh "rsync --exclude=.svn --exclude=.git -rav -e ssh --delete /tmp/$env.SITEIDdocs/ webadmin@stageserv:/var/opt/httpd/$env.SITEIDdocs/"
// fix the owner/permissions on the staging server
sh "ssh webadmin@stageserv "sudo chown -R apache:$env.SITEID-web /var/opt/httpd/$env.SITEIDdocs/""
sh "ssh webadmin@stageserv "sudo chmod -R g+w /var/opt/httpd/$env.SITEIDdocs/""
sh "ssh webadmin@stageserv "sudo find /var/opt/httpd/$env.SITEIDdocs/ -type d -exec chmod g+s \;""

// delete the temporary files on the control server
sh "rm -Rf /tmp/$env.SITEIDdocs/"
// clear the caches
sh "wget -O - "http://www.web.net/incacache.php?api_key=yoiVbjgtL&site_id=088""


stage("deploy-db-production")
when
allOf
environment ignoreCase: true, name: "DEPLOY_TO", value: "production";
environment ignoreCase: true, name: "DEPLOY_DB", value: "yes";


steps
script
def myexcludes = env.EXCLUDE.split(',').toList()
MYFLAGS = "-Q -K -c -e --default-character-set=utf8 "
if (env.NOFLAGS == "0")
myexcludes.each
MYFLAGS = "$MYFLAGS --ignore-table=$env.DBNAME_stage.$it"



sh "cd $WORKSPACE"
// pull a backup of the current staging database (may exclude some tables)
sh "mysqldump -h $env.DBSERVER -u $env.DBUSER --password='$env.DBPASS' $env.DBNAME_stage $MYFLAGS > $env.DBNAME_stage.sql"
// create a backup copy of the current production database (full backup)
sh "mysqldump -h $env.DBSERVER -u $env.DBUSER --password='$env.DBPASS' $env.DBNAME_prod > $env.DBNAME_prod_bak.sql"
// upload the staging database dump to the production database
sh "mysql -h $env.DBSERVER -u $env.DBUSER --password='$env.DBPASS' $env.DBNAME_prod < $WORKSPACE/$env.DBNAME_stage.sql"


stage("deploy-production")
when
environment ignoreCase: true, name: "DEPLOY_TO", value: "production"

steps
// copy files from staging to control server
sh "rsync --exclude=.svn --exclude=.git -rav -e ssh webadmin@stageserv:/var/opt/httpd/$env.SITEIDdocs/ /tmp/$env.SITEIDdocs/"

// prepare the production server to receive files by changing the owner
sh "ssh webadmin@appserv3 "sudo chown -R webadmin:webadmin /var/opt/httpd/$env.SITEIDdocs/""
sh "ssh webadmin@appserv4 "sudo chown -R webadmin:webadmin /var/opt/httpd/$env.SITEIDdocs/""
// copy files from control server to production
sh "rsync --exclude=.svn --exclude=.git -rav -e ssh --delete /tmp/$env.SITEIDdocs/ webadmin@appserv3:/var/opt/httpd/$env.SITEIDdocs/"
sh "rsync --exclude=.svn --exclude=.git -rav -e ssh --delete /tmp/$env.SITEIDdocs/ webadmin@appserv4:/var/opt/httpd/$env.SITEIDdocs/"
// fix the owner/permissions on the production server
sh "ssh webadmin@appserv3 "sudo chown -R apache:$env.SITEID-web /var/opt/httpd/$env.SITEIDdocs/""
sh "ssh webadmin@appserv4 "sudo chown -R apache:$env.SITEID-web /var/opt/httpd/$env.SITEIDdocs/""
sh "ssh webadmin@appserv3 "sudo chmod -R g+w /var/opt/httpd/$env.SITEIDdocs/""
sh "ssh webadmin@appserv4 "sudo chmod -R g+w /var/opt/httpd/$env.SITEIDdocs/""
sh "ssh webadmin@appserv3 "sudo find /var/opt/httpd/$env.SITEIDdocs/ -type d -exec chmod g+s \;""
sh "ssh webadmin@appserv4 "sudo find /var/opt/httpd/$env.SITEIDdocs/ -type d -exec chmod g+s \;""

// delete the temporary files on the control server
sh "rm -Rf /tmp/$env.SITEIDdocs/"
// clear the caches
sh "wget -O - "http://www.web.net/incacache.php?api_key=yoiVbjgtL&site_id=088""







Any help on this will be appreciated!







git jenkins






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 9 at 19:13

























asked Nov 8 at 20:19









VaTo

1,3671537




1,3671537











  • The real problem is : Why does it takes more than 10 minutes to fetch ?
    – André DS
    Nov 8 at 21:12










  • @AndréDS is a big repo, around 3GB
    – VaTo
    Nov 9 at 0:00










  • Consider pasting your build log and Jenkinsfile right into this question. The links are dead.
    – Ken Rachynski
    Nov 9 at 18:10










  • @KenRachynski Thank you for pointing that out. I just updated the post with the right links.
    – VaTo
    Nov 9 at 19:46
















  • The real problem is : Why does it takes more than 10 minutes to fetch ?
    – André DS
    Nov 8 at 21:12










  • @AndréDS is a big repo, around 3GB
    – VaTo
    Nov 9 at 0:00










  • Consider pasting your build log and Jenkinsfile right into this question. The links are dead.
    – Ken Rachynski
    Nov 9 at 18:10










  • @KenRachynski Thank you for pointing that out. I just updated the post with the right links.
    – VaTo
    Nov 9 at 19:46















The real problem is : Why does it takes more than 10 minutes to fetch ?
– André DS
Nov 8 at 21:12




The real problem is : Why does it takes more than 10 minutes to fetch ?
– André DS
Nov 8 at 21:12












@AndréDS is a big repo, around 3GB
– VaTo
Nov 9 at 0:00




@AndréDS is a big repo, around 3GB
– VaTo
Nov 9 at 0:00












Consider pasting your build log and Jenkinsfile right into this question. The links are dead.
– Ken Rachynski
Nov 9 at 18:10




Consider pasting your build log and Jenkinsfile right into this question. The links are dead.
– Ken Rachynski
Nov 9 at 18:10












@KenRachynski Thank you for pointing that out. I just updated the post with the right links.
– VaTo
Nov 9 at 19:46




@KenRachynski Thank you for pointing that out. I just updated the post with the right links.
– VaTo
Nov 9 at 19:46












1 Answer
1






active

oldest

votes

















up vote
1
down vote



accepted










Just so everyone knows, my issue was related to a bug in the version of Jenkins I have (2.129). I just had to uncheck the option "Lightweight checkout" inside of the configuration for the Job. The problem seems to be with Bitbucket, it tries to make an API call to retrieve the Jenkinsfile first but it doesn't get any response from bitbucket and it times out. Hopefully that's helpful for anyone else having the same problem






share|improve this answer




















    Your Answer






    StackExchange.ifUsing("editor", function ()
    StackExchange.using("externalEditor", function ()
    StackExchange.using("snippets", function ()
    StackExchange.snippets.init();
    );
    );
    , "code-snippets");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "1"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













     

    draft saved


    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53215531%2fjenkins-hudson-plugins-git-gitexception-command-git-fetch-tags-progress-o%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    1
    down vote



    accepted










    Just so everyone knows, my issue was related to a bug in the version of Jenkins I have (2.129). I just had to uncheck the option "Lightweight checkout" inside of the configuration for the Job. The problem seems to be with Bitbucket, it tries to make an API call to retrieve the Jenkinsfile first but it doesn't get any response from bitbucket and it times out. Hopefully that's helpful for anyone else having the same problem






    share|improve this answer
























      up vote
      1
      down vote



      accepted










      Just so everyone knows, my issue was related to a bug in the version of Jenkins I have (2.129). I just had to uncheck the option "Lightweight checkout" inside of the configuration for the Job. The problem seems to be with Bitbucket, it tries to make an API call to retrieve the Jenkinsfile first but it doesn't get any response from bitbucket and it times out. Hopefully that's helpful for anyone else having the same problem






      share|improve this answer






















        up vote
        1
        down vote



        accepted







        up vote
        1
        down vote



        accepted






        Just so everyone knows, my issue was related to a bug in the version of Jenkins I have (2.129). I just had to uncheck the option "Lightweight checkout" inside of the configuration for the Job. The problem seems to be with Bitbucket, it tries to make an API call to retrieve the Jenkinsfile first but it doesn't get any response from bitbucket and it times out. Hopefully that's helpful for anyone else having the same problem






        share|improve this answer












        Just so everyone knows, my issue was related to a bug in the version of Jenkins I have (2.129). I just had to uncheck the option "Lightweight checkout" inside of the configuration for the Job. The problem seems to be with Bitbucket, it tries to make an API call to retrieve the Jenkinsfile first but it doesn't get any response from bitbucket and it times out. Hopefully that's helpful for anyone else having the same problem







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 9 at 22:21









        VaTo

        1,3671537




        1,3671537



























             

            draft saved


            draft discarded















































             


            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53215531%2fjenkins-hudson-plugins-git-gitexception-command-git-fetch-tags-progress-o%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            𛂒𛀶,𛀽𛀑𛂀𛃧𛂓𛀙𛃆𛃑𛃷𛂟𛁡𛀢𛀟𛁤𛂽𛁕𛁪𛂟𛂯,𛁞𛂧𛀴𛁄𛁠𛁼𛂿𛀤 𛂘,𛁺𛂾𛃭𛃭𛃵𛀺,𛂣𛃍𛂖𛃶 𛀸𛃀𛂖𛁶𛁏𛁚 𛂢𛂞 𛁰𛂆𛀔,𛁸𛀽𛁓𛃋𛂇𛃧𛀧𛃣𛂐𛃇,𛂂𛃻𛃲𛁬𛃞𛀧𛃃𛀅 𛂭𛁠𛁡𛃇𛀷𛃓𛁥,𛁙𛁘𛁞𛃸𛁸𛃣𛁜,𛂛,𛃿,𛁯𛂘𛂌𛃛𛁱𛃌𛂈𛂇 𛁊𛃲,𛀕𛃴𛀜 𛀶𛂆𛀶𛃟𛂉𛀣,𛂐𛁞𛁾 𛁷𛂑𛁳𛂯𛀬𛃅,𛃶𛁼

            How do I collapse sections of code in Visual Studio Code for Windows?

            Node.js puppeteer - Use values from array in a loop to cycle through pages