1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 |
- <?php
- include ('variables.php');
- class compareCest
- {
- public function compare(AcceptanceTester $I)
- {
- $cliente=$_GET['CLIENTE'];
- $hora = date("H:i");
- $fecha = date("Y-n-j");
- $head = shell_exec('git rev-parse HEAD');
- $head = substr($head,0,-1);
- $directorioA = array('01_login/','02_base/','03_ftth/','04_map/','05_stats/');
- $cantdir= count($directorioA);
- for ($i = 0; $i < $cantdir; $i++)
- {
- $directorio = $directorioA[$i];
- shell_exec('mkdir -p ./tests/comp/'. $cliente . "/" . $fecha . "_" . $hora . "_" . $head ."/" . $directorio);
- $dir = opendir("tests/_output/debug/" . $cliente . "/" . $head . "/" . $directorio);
- while ($archivo = readdir($dir))
- {
- if (is_dir($archivo))
- {
- }
- else
- {
- shell_exec('compare tests/_output/debug/'. $cliente . "/" . $head . "/". $directorio . $archivo . ' tests/screenSRC/'. $cliente . "/". $directorio . $archivo . ' tests/comp/'. $cliente . "/" . $fecha . "_" . $hora . "_" . $head . "/" . $directorio .'comp'. $archivo . "\n");
- }
- }
- }
- echo "Comparación hecha con éxito";
- //subo comparaciones
- date_default_timezone_set('America/Argentina/Buenos_Aires');
- require 'vendor/autoload.php';
- $s3 = new Aws\S3\S3Client([
- 'version' => 'latest',
- 'region' => 'sa-east-1',
- 'endpoint' => 'https://s3.infra.flowdat.com/minio/login',
- 'use_path_style_endpoint' => true,
- 'credentials' => [
- 'key' => 'iksop',
- 'secret' => '8htoiwn44g204th',
- ],
- ]);
- //subo al HipChat
- $ROOM_ID="drone-ci";
- $AUTH_TOKEN="umxTgNpdzUS4egXqpZvGmmYrpLWApANHBKUcciMk";
- $MESSAGE1="Inicio Commit ID: " . $head;
- $MESSAGE2="Fin Commit ID: " . $head;
- shell_exec('curl -H "Content-Type: application/json" -X POST -d "{\"color\": \"purple\", \"message_format\": \"text\", \"message\": \"' . $MESSAGE1 . '\" }" https://api.hipchat.com/v2/room/' . $ROOM_ID . '/notification?auth_token=' . $AUTH_TOKEN);
- $directorioA = array('01_login/','02_base/','03_ftth/','04_map/','05_stats/');
- for ($i = 0; $i < $cantdir; $i++)
- {
- $dir = $directorioA[$i];
- $directorio = opendir("./tests/comp/" . $cliente . "/" . $fecha . "_" . $hora . "_" . $head . "/" . $dir);
- while ($archivo = readdir($directorio))
- {
- if (is_dir($archivo))
- {
- }
- else
- {
- $result = $s3->putObject(array(
- 'Bucket' => 'comparaciones',
- 'Key' => $cliente . "/" . $fecha . "_" . $hora . "_" . $head . '/' . $dir . $archivo,
- 'SourceFile' => './tests/comp/'.$cliente . "/" . $fecha . "_" . $hora . "_" . $head ."/" . $dir . $archivo
- ));
- // We can poll the object until it is accessible
- $s3->waitUntil('ObjectExists', array(
- 'Bucket' => 'comparaciones',
- 'Key' => $cliente . "/" .$fecha . "_" . $hora . "_" . $head . '/' . $dir . $archivo
- ));
- shell_exec('curl -H "Content-Type: multipart/related; boundary=boundary123456" -F "file=@tests/comp/'.$cliente."/" . $fecha . '_' . $hora . '_' . $head .'/' . $dir . $archivo.'" -X POST https://api.hipchat.com/v2/room/'.$ROOM_ID.'/share/file?auth_token='.$AUTH_TOKEN);
- }
- }
- echo "Directorio de comparación '" . $dir . "' actualizado. Fecha: " . $fecha . "_" . $hora . " Commit: " . $head . " Cliente: " . $cliente ."\n" ;
- }
- shell_exec('curl -H "Content-Type: application/json" -X POST -d "{\"color\": \"purple\", \"message_format\": \"text\", \"message\": \"' . $MESSAGE2 . '\" }" https://api.hipchat.com/v2/room/' . $ROOM_ID . '/notification?auth_token=' . $AUTH_TOKEN);
-
- }
- }
|