Skip to content
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

Add option/envvar to disable banner #1561

Closed
fabiang opened this issue Nov 26, 2020 · 9 comments · Fixed by #2871
Closed

Add option/envvar to disable banner #1561

fabiang opened this issue Nov 26, 2020 · 9 comments · Fixed by #2871

Comments

@fabiang
Copy link

fabiang commented Nov 26, 2020

Environment

Liquibase Version: >=4.0

Liquibase Integration & Version: CLI

Liquibase Extension(s) & Version: -

Database Vendor & Version: -

Operating System Type & Version: -

Description

Add an global config option or environment variable to disable the banner when executing Liquibase on CLI. Polluting my buffer is annoying af. Thanks.

User Story

As a CLI or automation user, i want control of the banner output, so that I dont see the liquibase logo banner if i dont want.

Requirements

  • enable true|false flag to show banner or not with default of true
    • ENV var: LIQUIBASE_BANNER=[true | false]
    • defaults file: liquibase.banner=[true | false]
    • CLI: --banner=[true | false]

Acceptance Criteria

  • user can determine to see liquibase banner or not
@molivasdat
Copy link
Contributor

Hi @fabiang Thanks for creating this request. We will add it to the list of issues to process.

@piefel
Copy link

piefel commented Jun 10, 2021

Using the Gradle plugin, thanks to preLiquibaseRun, liquibaseRun and postLiquibaseRun, I see that banner three times.

@petromir
Copy link

petromir commented Jun 18, 2021

Hi, when do you expect to implement this?

@molivasdat
Copy link
Contributor

Hi @petromir It's on the list but not a high priority at the moment.

@ahaleiii
Copy link

ahaleiii commented Aug 29, 2021

As one who creates scripts and consumes their logs, +1 to this.

Created a PowerShell (7.1.4) function to strip the banner. Probably overkill. It handles --log-level='debug' cases when there is text before the banner. (Update: now handles cases when there is no banner at all.)

# personal preference: do not assume constant number of lines in banner
function removeLiquibaseBanner($outputTextArray) {
    $bannerBorder = '####################################################'

    $preBannerTextArray = @()
    $inBanner = $false
    $lineAfterBanner = -1
    for ($i = 0; $i -lt $outputTextArray.Count; $i++) {
        $line = $outputTextArray[$i]
        $isBannerBorder = $line.ToString() -eq $bannerBorder
        if (-not $inBanner -and $isBannerBorder) {
            $inBanner = $true
        } elseif (-not $inBanner) {
            $preBannerTextArray += $line
        } elseif ($isBannerBorder) {
            $lineAfterBanner = $i + 1
            break
        }
    }

    if ($lineAfterBanner -lt 0) {
        return $preBannerTextArray
    }

    $lastLine = $outputTextArray.Count - 1
    $postBannerTextArray = $outputTextArray[$lineAfterBanner..$lastLine]
    return $preBannerTextArray + $postBannerTextArray
}

Running via the Docker image:

$❯ $output = Invoke-Expression "& docker run --rm liquibase/liquibase:latest --log-level='debug' --version 2>&1"
$❯ $outputNoBanner = removeLiquibaseBanner $output

Output with banner:

$❯ $output
[2021-08-29 19:35:41] FINE [liquibase.configuration] No configuration value for liquibase.hub.apiKey found
[2021-08-29 19:35:41] FINE [liquibase.configuration] No configuration value for liquibase.filterLogMessages found
[2021-08-29 19:35:41] FINE [liquibase.resource] Adding path /liquibase/. to resourceAccessor liquibase.resource.FileSystemResourceAccessor
[2021-08-29 19:35:41] FINE [liquibase.configuration] No configuration value for liquibase.shouldRun aka should.run found
[2021-08-29 19:35:41] FINE [liquibase.configuration] Configuration liquibase.shouldRun is using the default value of true
####################################################
##   _     _             _ _                      ##
##  | |   (_)           (_) |                     ##
##  | |    _  __ _ _   _ _| |__   __ _ ___  ___   ##
##  | |   | |/ _` | | | | | '_ \ / _` / __|/ _ \  ##
##  | |___| | (_| | |_| | | |_) | (_| \__ \  __/  ##
##  \_____/_|\__, |\__,_|_|_.__/ \__,_|___/\___|  ##
##              | |                               ##
##              |_|                               ##
##                                                ##
##  Get documentation at docs.liquibase.com       ##
##  Get certified courses at learn.liquibase.com  ##
##  Free schema change activity reports at        ##
##      https://hub.liquibase.com                 ##
##                                                ##
####################################################
Starting Liquibase at 19:35:41 (version 4.4.3 #53 built at 2021-08-05 18:32+0000)
Running Java under /usr/local/openjdk-11 (Version 11.0.12)

Liquibase Version: 4.4.3
Liquibase Community 4.4.3 by Datical

Output without banner:

$❯ $outputNoBanner
[2021-08-29 19:35:41] FINE [liquibase.configuration] No configuration value for liquibase.hub.apiKey found
[2021-08-29 19:35:41] FINE [liquibase.configuration] No configuration value for liquibase.filterLogMessages found
[2021-08-29 19:35:41] FINE [liquibase.resource] Adding path /liquibase/. to resourceAccessor liquibase.resource.FileSystemResourceAccessor
[2021-08-29 19:35:41] FINE [liquibase.configuration] No configuration value for liquibase.shouldRun aka should.run found
[2021-08-29 19:35:41] FINE [liquibase.configuration] Configuration liquibase.shouldRun is using the default value of true
Starting Liquibase at 19:35:41 (version 4.4.3 #53 built at 2021-08-05 18:32+0000)
Running Java under /usr/local/openjdk-11 (Version 11.0.12)

Liquibase Version: 4.4.3
Liquibase Community 4.4.3 by Datical

Caveats:

  • Using PowerShell
  • Using Invoke-Expression which is not necessarily best practice
  • Output is captured to variable rather than streamed to host
    • My script is most likely going to need to parse this text anyways, so it was inevitable either way.

@jimpriest
Copy link

Another vote for this feature. Scripting anything just results in all this noise that I don't care about :) I know I'm running a Liquibase command LOL.

@ridicolos
Copy link

Would love to see this be implemented. After running several liquibase commands in a row, the terminal looks very cluttered which is quite annoying.

@kataggart kataggart linked a pull request Jun 3, 2022 that will close this issue
@kataggart
Copy link
Contributor

@ridicolos GOOD NEWS! This is merged and will be included in the next release!

@kataggart
Copy link
Contributor

For everyone following along, this is now released

#2871

... also if you have five min to spare would love your input!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

8 participants