Last active
May 6, 2019 10:42
-
-
Save Stephanevg/073a710bf84a663c687fb9a80ad92af9 to your computer and use it in GitHub Desktop.
List all Gitlab variables
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Function Get-GitLabCIVariableValues { | |
$Standardvariables = Get-Variable | ? {$_.Name -like "CI*" -or $_.Name -like "*GITLAB_*"} | |
#$NonStandardVariables = Get-Variable -Name "RESTORE_CACHE_ATTEMPTS","CHAT_INPUT","CHAT_CHANNEL","GET_SOURCES_ATTEMPTS","ARTIFACT_DOWNLOAD_ATTEMPTS" | |
$return = $Standardvariables #+ $NonStandardVariables | |
return $return | |
} | |
$FullLocalRepoPath = (Get-Variable -Name CI_PROJECT_DIR -ValueOnly).Replace("/","\") | |
$CommitMessage = Get-Variable -Name CI_COMMIT_TITLE -ValueOnly | |
Write-Host "[COMMIT] $($CommitMessage)" | |
set-location -Path $FullLocalRepoPath | |
if($CommitMessage -match ".*export_var.*"){ | |
Write-host "[VARIABLES] Exporting Variables"-ForegroundColor Green | |
$ExportFile = join-Path -Path $BuildPath -ChildPath "CI_Variables.csv" | |
Get-GitLabCIVariableValues | Select Name,Value,Description| export-csv -path $ExportFile -NoTypeInformation | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment