Skip to content

Add ansible verbose pr 1.x #172

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions src/commands/deploy.ts
Original file line number Diff line number Diff line change
@@ -1,32 +1,46 @@
import AnsibleCmd from '../base-cmd-ansible-abstract'
import {flags} from '@oclif/command'

export default class DeployCmd extends AnsibleCmd {
static description = 'Setup an app with Ansible playbooks.'

static examples = [
'$ ce-dev deploy example-app',
'$ ce-dev deploy example-app --verbose',
]

static flags = {
help: flags.help({char: 'h'}),
verbose: flags.boolean({
char: 'v',
description: 'Enable verbose output in Ansible.',
}),
}

protected ansibleProjectPlaybooksPath = '/home/ce-dev/projects-playbooks/deploy'

protected ansibleScriptsPath = '/home/ce-dev/ce-deploy'

protected ansibleScript = 'scripts/deploy.sh'

protected verbose = false

/**
* @inheritdoc
*/
public constructor(argv: string[], config: any) {
super(argv, config)
const {flags} = this.parse(DeployCmd)
this.ansiblePaths = this.activeProjectInfo.deploy
if (flags.verbose) this.verbose = true
}

protected getCommandParameters(ansiblePath: string): string {
const workspace = this.ansibleProjectPlaybooksPath
const buildId = this.activeProjectInfo.project_name
const ownBranch = '1.x'
const configBranch = '1.x'
const cmd = '--own-branch ' + ownBranch + ' --config-branch ' + configBranch + ' --workspace ' + workspace + ' --build-id ' + buildId + ' --playbook ' + ansiblePath + ' --build-number 1 --previous-stable-build-number 1 --ansible-extra-vars \'{"is_local":"true"}\''
let cmd = '--own-branch ' + ownBranch + ' --config-branch ' + configBranch + ' --workspace ' + workspace + ' --build-id ' + buildId + ' --playbook ' + ansiblePath + ' --build-number 1 --previous-stable-build-number 1 --ansible-extra-vars \'{"is_local":"true"}\''
if (this.verbose) cmd += ' --verbose'
return cmd
}
}
10 changes: 9 additions & 1 deletion src/commands/provision.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default class ProvisionCmd extends AnsibleCmd {
static description = 'Provision containers with Ansible playbooks.'

static examples = [
'$ ce-dev provision --branch 1.x --config 1.x',
'$ ce-dev provision --branch 1.x --config 1.x --verbose',
]

static flags = {
Expand All @@ -20,6 +20,10 @@ export default class ProvisionCmd extends AnsibleCmd {
description: 'The branch of the ce-provision-config repository. See https://github.com/codeenigma/ce-dev-ce-provision-config for options.',
default: '1.x',
}),
verbose: flags.boolean({
char: 'v',
description: 'Enable verbose output in Ansible.',
}),
}

protected ansibleProjectPlaybooksPath = '/home/ce-dev/projects-playbooks/provision'
Expand All @@ -32,6 +36,8 @@ export default class ProvisionCmd extends AnsibleCmd {

protected configBranch = '1.x'

protected verbose = false

/**
* @inheritdoc
*/
Expand All @@ -41,12 +47,14 @@ export default class ProvisionCmd extends AnsibleCmd {
this.ansiblePaths = this.activeProjectInfo.provision
this.ownBranch = flags.branch
this.configBranch = flags.config
if (flags.verbose) this.verbose = true
}

protected getCommandParameters(ansiblePath: string): string {
const workspace = this.ansibleProjectPlaybooksPath
const repo = this.activeProjectInfo.project_name
let cmd = '--own-branch ' + this.ownBranch
if (this.verbose) cmd += ' --verbose'
cmd += ' --config-branch ' + this.configBranch
cmd += ' --workspace ' + workspace
cmd += ' --repo ' + repo
Expand Down