diff --git a/src/ts/plugins/server/GitlabConnector.ts b/src/ts/plugins/server/GitlabConnector.ts index fb9f6aced..97738bec5 100644 --- a/src/ts/plugins/server/GitlabConnector.ts +++ b/src/ts/plugins/server/GitlabConnector.ts @@ -39,6 +39,7 @@ export interface GitlabOptions { repoPrefix: string scope: string domain: string + timeOut: number } export interface GitlabToken { @@ -201,7 +202,7 @@ export default class GitlabConnector implements StorageConnector { if(!this.options.clientId) throw new Error('Missing Gitlab client ID') if(!this.options.clientSecret) throw new Error('Missing Gitlab client secret') if(!this.options.domain) throw new Error('Missing Gitlab domain') - + if(!this.options.timeOut) this.options.timeOut = 15000 /* default value */ } // ** diff --git a/src/ts/plugins/server/GitlabHostingConnector.ts b/src/ts/plugins/server/GitlabHostingConnector.ts index 26e21219c..dc2ca073e 100644 --- a/src/ts/plugins/server/GitlabHostingConnector.ts +++ b/src/ts/plugins/server/GitlabHostingConnector.ts @@ -26,9 +26,10 @@ import GitlabConnector, { GitlabOptions, GitlabSession} from './GitlabConnector' import { HostingConnector, ConnectorFile } from '../../server/connectors/connectors' import { ConnectorType, WebsiteId, JobData, JobStatus, PublicationJobData } from '../../types' import { JobManager } from '../../server/jobs' -import { join } from 'path' import { ServerConfig } from '../../server/config' -import { stat } from 'fs' +import { setTimeout } from 'timers/promises' + +const waitTimeOut = 5000 /* for wait loop in job pages getting */ export default class GitlabHostingConnector extends GitlabConnector implements HostingConnector { @@ -80,8 +81,8 @@ export default class GitlabHostingConnector extends GitlabConnector implements H // Update the job status if(status === JobStatus.SUCCESS) { /* Squash and tag the commits */ - const succes = await this.createTag(session, websiteId, job, { startJob, jobSuccess, jobError }) - if(!succes) { + const successTag = await this.createTag(session, websiteId, job, { startJob, jobSuccess, jobError }) + if(!successTag) { // jobError will have been called in createTag return } @@ -100,7 +101,7 @@ export default class GitlabHostingConnector extends GitlabConnector implements H job.logs[0].push(`Page URL: ${pageUrl}`) job.message = 'Getting the deployment logs URL...' job.logs[0].push(job.message) - const gitlabJobLogsUrl = await this.getGitlabJobLogsUrl(session, websiteId, adminUrl) + const gitlabJobLogsUrl = await this.getGitlabJobLogsUrl(session, websiteId, job, { startJob, jobSuccess, jobError }, adminUrl, successTag) job.logs[0].push(`Deployment logs URL: ${gitlabJobLogsUrl}`) const message = `
Your website is now live here.
@@ -146,12 +147,23 @@ export default class GitlabHostingConnector extends GitlabConnector implements H return `${projectUrl}/pages` } - async getGitlabJobLogsUrl(session: GitlabSession, websiteId: WebsiteId, projectUrl: string): Promise