Giter Club home page Giter Club logo

yuniql-azure-pipelines-tasks's Introduction

Yuniql Azure Pipelines Tasks

Run database migrations and schema versioning with Yuniql. Supports SqlServer, PostgreSql, MySql and others. For samples and developer guide, walk through our documentation and bookmark https://yuniql.io.

Pre-requisites

  • Verified with test pipelines on Windows-based and Ubuntu-based Hosted Agents.

  • Requires a yuniql compliant directory structure. To create this structure, install yuniql-cli, issue yuniql init, and commit to a git repository. Use the repository as input artifact to the pipelines. You may also copy our project samples for your target database platform and commit to your own repo.

Azure DevOps YAML Pipelines

trigger:
- master

pool:
  vmImage: 'windows-latest'

steps:
- task: UseYuniqlCLI@0
  inputs:
    version: 'latest'

- task: RunYuniqlCLI@0
  inputs:
    version: 'latest'
    connectionString: 'Server=tcp:<AZ-SQLSERVER>,1433;Initial Catalog=<AZ-SQLDB>;User ID=<USERID>;Password=<PASSWORD>;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;'
    workspacePath: '$(Build.SourcesDirectory)\samples\basic-sqlserver-sample'
    targetPlatform: 'SqlServer'
    additionalArguments: '--debug'

This runs database migration with yuniql-cli.

  • version: The version of Yuniql CLI. If omitted, the latest version of yuniql-cli is installed. Visit releases to get an appropriate version.
  • connectionString: The connection string to your target database server.
  • workspacePath: The location of your version directories to run.
  • targetPlatform: The target database platform. Default is SqlServer.
  • autoCreateDatabase: When true, creates and configure the database in the target server for yuniql migrations.
  • targetVersion: The maximum target database schema version to run to.
  • tokenKeyValuePair: Token key/value pairs for token replacement.
  • delimiter: The delimeter to use other than default comma when parsing CSV file.
  • additionalArguments: Additional CLI arguments such as --debug to enable trace message.

Use YUNIQL CLI Task

Downloads Yuniql CLI and make the CLI available for later tasks.

Run YUNIQL CLI Task

Runs the database migration based of defined execution parameters.

Verify YUNIQL CLI Task

Runs an uncommitted migration run. This performs a dry-run migration to verify if all works good should the versions be decided to be applied. Requires at least one successful run was made in the target database.

Erase YUNIQL CLI Task

Erases the target database objects (tables, procedures, functions, and others) using user defined clean-up scripts placed in _erase directory. Yuniql doesn't have automated erasure so user have to prepare the scope of erasure.

WARNING: This is helpful in Dev and Test. Be very careful and remove this task when cloning pipelines for Production!

License

Copyright (C) 2019 Rodel E. Dagumampan

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Found bugs?

Help us improve further please create an issue.

yuniql-azure-pipelines-tasks's People

Contributors

rdagumampan avatar

Watchers

James Cloos avatar  avatar  avatar

yuniql-azure-pipelines-tasks's Issues

##[error]Path must be a string. Received undefined

I'm having error ##[error]Path must be a string. Received undefined which I don't understand the cause. I thought it's about missing yuniql tool, but it doesn't help when I install yuniql.cli manually. Here's my config:

- task: DotNetCoreCLI@2
  displayName: 'Install yuniql'
  inputs:
    command: 'custom'
    custom: 'tool'
    arguments: 'install -g yuniql.cli --add-source https://api.nuget.org/v3/index.json --ignore-failed-sources --version $(YuniqlVersion)'
    workingDirectory: $(DBcheckoutPath)
- task: RunYuniqlCLI@1
  displayName: 'Deploy DB'
  inputs:
    autoCreateDatabase: true
    version: '$(YuniqlVersion)'
    targetVersion: 'latest'        
    additionalArguments: '--environment dev'
    targetPlatform: sqlserver
    workspacePath: $(DBcheckoutPath)
    connectionString: 'Data Source=$(DBServer);Password=$(DBPassword);Persist Security Info=True;User ID=$(DBUser);Initial Catalog=$(DbNameGenerator.DBName);'
    tokenKeyValuePair: 'Dummy=Test'

And this's the error log detail:

Starting: Deploy DB
==============================================================================
Task         : Run yuniql
Description  : Runs database migrations with Yuniql CLI using version acquired from Use Yuniql task.
Version      : 1.190.0
Author       : Rodel E. Dagumampan
Help         : https://yuniql.io/docs/migrate-via-azure-devops-pipelines/
==============================================================================
yuniql/input_version: latest
yuniql/input_workspacePath: D:\ws\2\db
yuniql/input_connectionString: Data Source=(local);Password=***;Persist Security Info=True;User ID=sa;Initial Catalog=APItest_3a7cbf864df541e88230dd1e6d586b5d;
yuniql/input_targetPlatform: sqlserver
yuniql/input_autoCreateDatabase: true
yuniql/input_targetVersion: latest
yuniql/input_tokenKeyValuePair: Dummy=Test
yuniql/input_delimiter: ,
yuniql/input_additionalArguments: --environment dev
yuniql/var_osPlat: win32
yuniql/var_osArch: x64
yuniql/error: Path must be a string. Received undefined
##[error]Path must be a string. Received undefined
Finishing: Deploy DB

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.