Fix for "git archive" doesn't work in GitLab

This commit is contained in:
Michael RICOIS 2017-03-21 12:06:54 +01:00
parent 49fb1ada43
commit 7a8a901b6d

View File

@ -1,4 +1,4 @@
#!/usr/bin/php
#!/usr/bin/env php
<?php
$shortopts = '';
$longopts = array(
@ -23,7 +23,7 @@ Utilisation : <?php echo $argv[0]; ?> {options}
}
// --- Variables
$reposPath = "ssh://git@192.168.78.249:10022/SCORES";
$reposPath = "ssh://git@gitlab.factory.insight.doubletrade.com:scores";
$exportPath = '/home/vhosts/deploy/export';
define('COMPOSER_HOME', '/home/vhosts/deploy/composer');
@ -50,9 +50,18 @@ if (file_exists($exportPath.'/'.$archiveProjet)) {
if (file_exists($exportPath.'/'.$projet.'.tar')) {
passthru('rm -rf '.$exportPath.'/'.$projet.'.tar');
}
// Git Archive
/*
passthru('git archive --remote='.$reposPath.'/'.$projet.'.git --prefix='.$archiveProjet.'/ -o '.
$exportPath.'/'.$projet.'.tar '.$version);
passthru('tar -xf '.$exportPath.'/'.$projet.'.tar --directory='.$exportPath);
passthru('rm -rf '.$exportPath.'/'.$projet.'.tar');
*/
// Git clone - because GitLab doesn't support 'git archive'
passthru('git clone -q -b '.$version.' '.$reposPath.'/'.$projet.'.git '.$exportPath.'/'.$archiveProjet);
passthru('rm -rf '.$exportPath.'/'.$archiveProjet.'/.git');
if (!file_exists($exportPath.'/'.$archiveProjet)) {
echo "Erreur\n";
exit(1);
@ -70,7 +79,6 @@ if (file_exists($exportPath.'/'.$archiveProjet.'/composer.lock')) {
}
}
passthru('rm -rf '.$exportPath.'/'.$projet.'.tar');
// --- Deploiement, pas de compression
if (array_key_exists('deploy', $options)) {
passthru('rm -rf '.$exportPath.'/'.$archiveProjet);