test: bump retries in gitbox.createRepo()
helper, see https://github.com/semantic-release/semantic-release/pull/1761\#issuecomment-767122221
This commit is contained in:
parent
16a9fb00e9
commit
ece7275743
@ -1,14 +1,14 @@
|
|||||||
const Docker = require('dockerode');
|
const Docker = require("dockerode");
|
||||||
const getStream = require('get-stream');
|
const getStream = require("get-stream");
|
||||||
const pRetry = require('p-retry');
|
const pRetry = require("p-retry");
|
||||||
const {initBareRepo, gitShallowClone} = require('./git-utils');
|
const { initBareRepo, gitShallowClone } = require("./git-utils");
|
||||||
|
|
||||||
const IMAGE = 'pvdlg/docker-gitbox:latest';
|
const IMAGE = "pvdlg/docker-gitbox:latest";
|
||||||
const SERVER_PORT = 80;
|
const SERVER_PORT = 80;
|
||||||
const HOST_PORT = 2080;
|
const HOST_PORT = 2080;
|
||||||
const SERVER_HOST = 'localhost';
|
const SERVER_HOST = "localhost";
|
||||||
const GIT_USERNAME = 'integration';
|
const GIT_USERNAME = "integration";
|
||||||
const GIT_PASSWORD = 'suchsecure';
|
const GIT_PASSWORD = "suchsecure";
|
||||||
const docker = new Docker();
|
const docker = new Docker();
|
||||||
let container;
|
let container;
|
||||||
|
|
||||||
@ -28,7 +28,7 @@ async function start() {
|
|||||||
await container.start();
|
await container.start();
|
||||||
|
|
||||||
const exec = await container.exec({
|
const exec = await container.exec({
|
||||||
Cmd: ['ng-auth', '-u', GIT_USERNAME, '-p', GIT_PASSWORD],
|
Cmd: ["ng-auth", "-u", GIT_USERNAME, "-p", GIT_PASSWORD],
|
||||||
AttachStdout: true,
|
AttachStdout: true,
|
||||||
AttachStderr: true,
|
AttachStderr: true,
|
||||||
});
|
});
|
||||||
@ -51,9 +51,9 @@ async function stop() {
|
|||||||
* @param {String} [description=`Repository ${name}`] The repository description.
|
* @param {String} [description=`Repository ${name}`] The repository description.
|
||||||
* @return {Object} The `repositoryUrl` (URL without auth) and `authUrl` (URL with auth).
|
* @return {Object} The `repositoryUrl` (URL without auth) and `authUrl` (URL with auth).
|
||||||
*/
|
*/
|
||||||
async function createRepo(name, branch = 'master', description = `Repository ${name}`) {
|
async function createRepo(name, branch = "master", description = `Repository ${name}`) {
|
||||||
const exec = await container.exec({
|
const exec = await container.exec({
|
||||||
Cmd: ['repo-admin', '-n', name, '-d', description],
|
Cmd: ["repo-admin", "-n", name, "-d", description],
|
||||||
AttachStdout: true,
|
AttachStdout: true,
|
||||||
AttachStderr: true,
|
AttachStderr: true,
|
||||||
});
|
});
|
||||||
@ -63,7 +63,7 @@ async function createRepo(name, branch = 'master', description = `Repository ${n
|
|||||||
const authUrl = `http://${gitCredential}@${SERVER_HOST}:${HOST_PORT}/git/${name}.git`;
|
const authUrl = `http://${gitCredential}@${SERVER_HOST}:${HOST_PORT}/git/${name}.git`;
|
||||||
|
|
||||||
// Retry as the server might take a few ms to make the repo available push
|
// Retry as the server might take a few ms to make the repo available push
|
||||||
await pRetry(() => initBareRepo(authUrl, branch), {retries: 3, minTimeout: 500, factor: 2});
|
await pRetry(() => initBareRepo(authUrl, branch), { retries: 5, minTimeout: 500, factor: 2 });
|
||||||
const cwd = await gitShallowClone(authUrl);
|
const cwd = await gitShallowClone(authUrl);
|
||||||
|
|
||||||
return { cwd, repositoryUrl, authUrl };
|
return { cwd, repositoryUrl, authUrl };
|
||||||
|
Loading…
x
Reference in New Issue
Block a user