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
param([Parameter(Mandatory=$true)][String]$branchNamePattern, $remoteName = 'origin', $branchBase='master') | |
$branchsToUpdate=(git branch --all|%{$_.ToString().Replace("remotes/$remoteName/",'').Trim()} | Select-String -Pattern $branchNamePattern); | |
$branchsToUpdate |%{git checkout $_; git merge "$remoteName/$branchBase"; if(-not $?){git merge --abort; git reset --hard}else{ git push } } |
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 k8s-certificates-renew{ | |
param([Parameter()][int]$days = 15) | |
((kubectl get certificates -A -o json | ConvertFrom-Json).items) | | |
?{[Datetime]($_.status.renewalTime) -lt (Get-Date).AddDays($days) }| | |
%{ [pscustomobject]@{Name=$_.metadata.name; RenewAt=[DateTime]$_.status.renewalTime; Namespace=$_.metadata. Namespace } } | |
} | |
function k8s-Select-Resources { | |
###Essa função é responsável por extrair as informações |
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
/* | |
ATENÇÃO: Esse comando não verifica se as alterações forma mescladas com a branch principal!! O branch vai ser apagado | |
*/ | |
param([Parameter(Mandatory=$true)][String]$branchNamePattern, $remoteName = 'origin') | |
git branch --all --merged | Select-String -Pattern $branchNamePattern | %{$_.ToString().Replace("remotes/$remoteName/",'').Trim()} | %{ git push origin :$_ } |
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
param( | |
[Parameter(Mandatory=$true)][System.String] $namespace, | |
[Parameter(Mandatory=$true)][int]$numberOfReplicas | |
) | |
kubectl get deployments -n $namespace --output jsonpath="{range .items[*]}{.metadata.name}{'\n'}{end}" |%{ | |
kubectl scale deployment/$_ -n $namespace --replicas $numberOfReplicas; | |
} |
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
CREATE PROCEDURE dbo.PROC_AddOrUpdateTableAndColumnDescription | |
@fullName varchar(255), | |
@description varchar(255) | |
AS | |
/* | |
Table exemple: <schema>.<table name> dbo.MyTable | |
Column Exemple: <schema>.<table name>.<column name> dbo.MyTable.Id | |
*/ | |
/*Extrai o primeiro valor antes do ponto, representa o schema*/ |
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
# This script help you setting an azure storage account as a network folder or windows disk | |
# Is need Azure CLI installed | |
param( | |
[System.String] | |
$resourceGroupName = "<resource group>", | |
[System.String] | |
$storageAccountName = "<storage account name>", | |
[System.String] | |
$subscription = "<subscription name or id>", |
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
param( | |
[Parameter(Mandatory=$true)] $acrAccountName, | |
$takeLastImages = 5, | |
$likeRepositories = '', | |
$selectTagPattern = '^([0-9]+(\.)?){3,4}$' | |
) | |
#Get all repository where the name like with parameter $likeRepositories | |
$repositories = az acr repository list --name $acrAccountName --query ("[?contains(@, '" + $likeRepositories + "')]") | ConvertFrom-Json ; |
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
#Esse script pode ser utilizado em tarefa do AzureDevOps para executar o backup da base de dados dentro do processo de Build ou Release | |
param( | |
$BaseStorageUri = "https://<your-storage>.blob.core.windows.net/backup-database", | |
$StorageKey = "<Shared key>", | |
$DatabaseName = @( "db1","db2","db3"), | |
$ResourceGroupName = "<database-resource-group-name>", | |
$ServerName = "<database-server-name>", | |
$serverAdmin = "<database-user-with-permission-login>", | |
$serverPassword = "<database-user-with-permission-password>" |