mirror of
https://github.com/elastic/kibana.git
synced 2025-04-25 02:09:32 -04:00
* Remove directory from dockerfiles target Produce a docker build context tarball without a top-level directory to match the expected format for downstream automation. This will produce: ``` $ tar -tzf target/kibana-8.0.0-docker-build-context.tar.gz Dockerfile bin/ config/ bin/kibana-docker config/kibana.yml ``` Instead of: ``` $ tar -tzf target/kibana-8.0.0-docker-build-context.tar.gz kibana-8.0.0-docker-build-context/Dockerfile kibana-8.0.0-docker-build-context/bin/ kibana-8.0.0-docker-build-context/config/ kibana-8.0.0-docker-build-context/bin/kibana-docker kibana-8.0.0-docker-build-context/config/kibana.yml ``` * Use options object for root directory config
This commit is contained in:
parent
bc210f7235
commit
d1167cd94e
3 changed files with 36 additions and 8 deletions
|
@ -207,8 +207,8 @@ export async function untar(source, destination, extractOptions = {}) {
|
||||||
|
|
||||||
export async function compress(type, options = {}, source, destination) {
|
export async function compress(type, options = {}, source, destination) {
|
||||||
const output = fs.createWriteStream(destination);
|
const output = fs.createWriteStream(destination);
|
||||||
const archive = archiver(type, options);
|
const archive = archiver(type, options.archiverOptions);
|
||||||
const name = source.split(sep).slice(-1)[0];
|
const name = (options.createRootDirectory ? source.split(sep).slice(-1)[0] : false);
|
||||||
|
|
||||||
archive.pipe(output);
|
archive.pipe(output);
|
||||||
|
|
||||||
|
|
|
@ -34,11 +34,36 @@ export const CreateArchivesTask = {
|
||||||
|
|
||||||
switch (path.extname(destination)) {
|
switch (path.extname(destination)) {
|
||||||
case '.zip':
|
case '.zip':
|
||||||
await compress('zip', { zlib: { level: 9 } }, source, destination);
|
await compress(
|
||||||
|
'zip',
|
||||||
|
{
|
||||||
|
archiverOptions: {
|
||||||
|
zlib: {
|
||||||
|
level: 9
|
||||||
|
}
|
||||||
|
},
|
||||||
|
createRootDirectory: true
|
||||||
|
},
|
||||||
|
source,
|
||||||
|
destination
|
||||||
|
);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case '.gz':
|
case '.gz':
|
||||||
await compress('tar', { gzip: true, gzipOptions: { level: 9 } }, source, destination);
|
await compress(
|
||||||
|
'tar',
|
||||||
|
{
|
||||||
|
archiverOptions: {
|
||||||
|
gzip: true,
|
||||||
|
gzipOptions: {
|
||||||
|
level: 9
|
||||||
|
}
|
||||||
|
},
|
||||||
|
createRootDirectory: true
|
||||||
|
},
|
||||||
|
source,
|
||||||
|
destination
|
||||||
|
);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -59,10 +59,13 @@ export async function bundleDockerFiles(config, log, build, scope) {
|
||||||
await compress(
|
await compress(
|
||||||
'tar',
|
'tar',
|
||||||
{
|
{
|
||||||
gzip: true,
|
archiverOptions: {
|
||||||
gzipOptions: {
|
gzip: true,
|
||||||
level: 9
|
gzipOptions: {
|
||||||
}
|
level: 9
|
||||||
|
}
|
||||||
|
},
|
||||||
|
createRootDirectory: false
|
||||||
},
|
},
|
||||||
dockerFilesBuildDir,
|
dockerFilesBuildDir,
|
||||||
dockerFilesOutputDir
|
dockerFilesOutputDir
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue