Skip to content

Commit

Permalink
Merge pull request #10 from Bielik20/ucp-deploy
Browse files Browse the repository at this point in the history
UCP deploy
  • Loading branch information
nandy-andy authored Mar 27, 2020
2 parents e94c675 + cdd9ec3 commit 81e44e0
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 6 deletions.
20 changes: 17 additions & 3 deletions src/commands/run/jobs-builder/deploy-job-builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ import { ParamsResult } from '../questions/param-questions.model';
import { Project } from '../questions/project-questions';
import { JobDescriptor } from './models';

interface DeployJobAppParams {
interface DeployJobAppAndUcpParams {
sandbox: string;
ucp_branch: string;
app_branch: string;
config_branch: string;
datacenter: string;
Expand All @@ -20,7 +21,8 @@ interface DeployJobMobileWikiParams {

export class DeployJobBuilder {
private projectNameMap = new Map<Project, string>([
['app', 'mediawiki-deploy-sandbox'],
['ucp', 'mediawiki-deploy-sandbox-ucp'],
['app', 'mediawiki-deploy-sandbox-ucp'],
['mobile-wiki', 'mobile-wiki-deploy-sandbox'],
]);

Expand All @@ -43,11 +45,23 @@ export class DeployJobBuilder {
private mapProjectParams(
project: Project,
input: ParamsResult,
): DeployJobAppParams | DeployJobMobileWikiParams {
): DeployJobAppAndUcpParams | DeployJobMobileWikiParams {
switch (project) {
case 'ucp':
return {
sandbox: input.sandbox,
ucp_branch: input.branch,
app_branch: 'dev',
config_branch: input.configBranch,
datacenter: input.datacenter,
crowdin_branch: input.crowdinBranch,
debug: input.debug,
};

case 'app':
return {
sandbox: input.sandbox,
ucp_branch: 'master',
app_branch: input.branch,
config_branch: input.configBranch,
datacenter: input.datacenter,
Expand Down
2 changes: 1 addition & 1 deletion src/commands/run/questions/param-questions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ const questions: FilterParamQuestion[] = [
default: store.sandbox,
destined: {
jobs: ['deploy', 'test'],
projects: ['app', 'mobile-wiki', 'f2'],
projects: ['ucp', 'app', 'mobile-wiki', 'f2'],
extended: false,
},
},
Expand Down
4 changes: 2 additions & 2 deletions src/commands/run/questions/project-questions.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import * as inquirer from 'inquirer';
import { filterList } from '../../../utils/filter-list';

export type Project = 'app' | 'mobile-wiki' | 'f2';
export const availableProjects: Project[] = ['app', 'mobile-wiki', 'f2'];
export type Project = 'ucp' | 'app' | 'mobile-wiki' | 'f2';
export const availableProjects: Project[] = ['ucp', 'app', 'mobile-wiki', 'f2'];

export async function verifyProjects(projects: string[]): Promise<Project[]> {
return filterList(projects, availableProjects, () => askForProjects());
Expand Down

0 comments on commit 81e44e0

Please sign in to comment.