MySql Database Deployment on Machine Group task
Azure DevOps Services
Use this task to run your scripts and make changes to your MySQL Database. There are two ways to deploy, either using a script file or writing the script in our inline editor. Note that this is an early preview version. Since this task is server based, it appears on Deployment group jobs.
Prerequisites
- MySQL Client in agent box
The task expects MySQL client must be in agent box.
Windows Agent: Use this script file to install MySQL client
Linux Agent: Run command 'apt-get install mysql-client' to install MySQL client
Task Inputs
| Parameters | Description |
|---|---|
TaskNameSelectorDeploy MySql Using | Select one of the options between Script File & Inline Script. Default value: SqlTaskFile |
SqlFileMySQL Script | (Required) Full path of the script file on the automation agent or on a UNC path accessible to the automation agent like, BudgetIT\DeployBuilds\script.sql. Also, predefined system variables like, $(agent.releaseDirectory) can also be used here. A file containing SQL statements can be used here. |
SqlInlineInline MySQL Script | (Required) MySQL script to execute on the Database |
ServerNameHost Name | (Required) Server name of Database for MySQL. Example: localhost. When you connect using MySQL Workbench, this is the same value that is used for 'Hostname' in 'Parameters'. Default value: localhost |
DatabaseNameDatabase Name | The name of database, if you already have one, on which the below script is needed to be run, else the script itself can be used to create the database. |
SqlUsernameMysql User Name | (Required) When you connect using MySQL Workbench, this is the same value that is used for 'Username' in 'Parameters' |
SqlPasswordPassword | (Required) Password for MySQL Database. It can be variable defined in the pipeline. Example : $(password). Mark the variable type as 'secret' to secure it. |
SqlAdditionalArgumentsAdditional Arguments | Additional options supported by MySQL simple SQL shell. These options will be applied when executing the given file on the Database for MySQL. Example: You can change to default tab separated output format to HTML or even XML format. Or if you have problems due to insufficient memory for large result sets, use the --quick option. |
Example
This example creates a sample db in MySQL.
steps:
- task: MysqlDeploymentOnMachineGroup@1
displayName: 'Deploy Using : InlineSqlTask'
inputs:
TaskNameSelector: InlineSqlTask
SqlInline: |
CREATE DATABASE IF NOT EXISTS alm;
use alm;
ServerName: localhost
SqlUsername: root
SqlPassword: P2ssw0rd
Open source
This task is open source on GitHub. Feedback and contributions are welcome.
Maklum balas
Kirim dan lihat maklum balas untuk