Skip to content

Commit

Permalink
prepare release
Browse files Browse the repository at this point in the history
some miscaleneous changes in prepartion of the release:

- run-as-user as image property

- support for large number of artifacts files (3500+)

- deploy copy does not use -a switch any longer (problems with different
  container users and docker, using tar instead)

- typo
  • Loading branch information
ktomk committed Feb 14, 2018
1 parent ea3a6bb commit cfd30cf
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 20 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ install:
- if [[ "${TRAVIS_PHP_VERSION}" == "7.0snapshot" ]]; then composer update; fi
- if [[ "${TRAVIS_PHP_VERSION}" == "7.0" ]]; then composer update; fi
- if [[ "${TRAVIS_PHP_VERSION}" == "5.6" ]]; then composer require --dev phpunit/phpunit ^5 --update-with-dependencies --no-suggest; fi
- composer install
- composer install --no-interaction --no-suggest --no-progress
- bin/pipelines --images | while read -r image; do docker image pull "$image"; done; true;

script:
Expand Down
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,16 @@ All notable changes to Pipelines will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [unreleased]
## [0.0.6] - 2018-02-14
### Added
- Support for .env / .env.dist file(s)
- Support for Docker Hub private repositories incl. providing
credentials via `--env` or `--env-file` environment variables
### Changed
- Readme for corrections and coverage
### Fixed
- Support for large number of artifacts files
- Crash with image `run-as-user` property in pipelines file
- Deploy copy mode fail-safe against copying errors (e.g.
permission denied on a file to copy)

Expand Down
3 changes: 0 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,6 @@ By default it operates on the current working tree which is
copied into the container to isolate running the pipeline from
the working directory by default (implicit `--deploy copy`).

This requires `docker copy` with the `-a` / `--archive` option
(since docker 17.06).

Alternatively the working directory can be mounted into the
pipelines container by using `--deploy mount`.

Expand Down
4 changes: 2 additions & 2 deletions doc/DOCKER-NAME-TAG.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ located at registry-1.docker.io by default.

<name-components>
:= <name-comp> ( "/" <name-comp> )?
<name-comp> := <name> ( <sperator> <name> )*
<name-comp> := <name> ( <seperator> <name> )*
<name> := [a-z0-9]+
<sperator> := "." | "_" "_"? | "-"+
<seperator> := "." | "_" "_"? | "-"+

"-" := ASCII 45 dash
"." := ASCII 46 period
Expand Down
2 changes: 1 addition & 1 deletion src/File/Image.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ private function parseArray(array $image)
$this->parseString($image['name']);
unset($image['name']);

$entries = array('username', 'password', 'email', 'aws');
$entries = array('run-as-user', 'username', 'password', 'email', 'aws');
$image = $this->properties->import($image, $entries);

if (!empty($image)) {
Expand Down
23 changes: 14 additions & 9 deletions src/Runner.php
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ private function deployCopy($copy, $id, $dir)
'c', '-f', '-', '.')
);
$dockerCp = Lib::cmd('docker ', array(
'cp', '-a', '-', $id . ':/app')
'cp', '-', $id . ':/app')
);
$status = $exec->pass("$cd && $tar | $dockerCp", array());
if ($status !== 0) {
Expand Down Expand Up @@ -313,16 +313,21 @@ private function captureArtifactPattern(ArtifactSource $source, $pattern, $id, $
return;
}

$tar = Lib::cmd('tar', array('c', '-f', '-', $paths));
$docker = Lib::cmd('docker', array('exec', '-w', '/app', $id));
$unTar = Lib::cmd('tar', array('x', '-f', '-', '-C', $dir));
$chunkSize = 2048;
$chunks = array_chunk($paths, $chunkSize, true);

$status = $exec->pass($docker . ' ' . $tar . ' | ' . $unTar, array());
foreach ($chunks as $paths) {
$tar = Lib::cmd('tar', array('c', '-f', '-', $paths));
$docker = Lib::cmd('docker', array('exec', '-w', '/app', $id));
$unTar = Lib::cmd('tar', array('x', '-f', '-', '-C', $dir));

if ($status !== 0) {
$streams->err(
sprintf("Artifact failure: '%s'\n", $pattern)
);
$status = $exec->pass($docker . ' ' . $tar . ' | ' . $unTar, array());

if ($status !== 0) {
$streams->err(
sprintf("pipelines: Artifact failure: '%s' (%d, %d paths)\n", $pattern, $status, count($paths))
);
}
}
}

Expand Down
7 changes: 6 additions & 1 deletion src/Utility/Version.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@

namespace Ktomk\Pipelines\Utility;


/**
* Utility class to obtain version of a PHP bases CLI utility including but not
* limited to a Git project context
*
* @package Ktomk\Pipelines\Utility
*/
class Version
{
/**
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/RunnerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ protected function setUp()

$this->deploy_copy_cmd = "cd /tmp/pipelines-test-suite/. " .
"&& tar c -f - . " .
"| docker cp -a - '*dry-run*:/app'";
"| docker cp - '*dry-run*:/app'";
}


Expand Down Expand Up @@ -313,7 +313,7 @@ public function testArtifactsFailure()
->expect('pass', 'docker exec -w /app \'*dry-run*\' tar c -f - build/foo-package.tgz | tar x -f - -C /tmp/pipelines-test-suite', 1)
;

$this->expectOutputString("Artifact failure: 'build/foo-package.tgz'\n");
$this->expectOutputString("pipelines: Artifact failure: 'build/foo-package.tgz' (1, 1 paths)\n");
$runner = new Runner(
'pipelines-unit-test',
'/tmp/pipelines-test-suite',
Expand Down

0 comments on commit cfd30cf

Please sign in to comment.