File tree Expand file tree Collapse file tree 2 files changed +22
-5
lines changed
Expand file tree Collapse file tree 2 files changed +22
-5
lines changed Original file line number Diff line number Diff line change @@ -698,13 +698,21 @@ $docker_enc_params=
698698
699699if ($mode -eq " server" ) {
700700 if (-not ([string ]::IsNullOrEmpty($props [$param_bito_access_key ])) -and -not ([string ]::IsNullOrEmpty($props [$param_git_access_token ]))) {
701- $git_secret = " $ ( $props [$param_bito_access_key ]) @#~^$ ( $props [$param_git_access_token ]) "
701+ if ($props [$param_git_provider ] -eq " BITBUCKET" ) {
702+ $git_secret = $props [$param_git_access_token ]
703+ # Truncate if longer than 60 characters
704+ if ($git_secret.Length -gt 60 ) {
705+ $git_secret = $git_secret.Substring (0 , 60 )
706+ }
707+ } else {
708+ $git_secret = " $ ( $props [$param_bito_access_key ]) @#~^$ ( $props [$param_git_access_token ]) "
709+ }
702710 $encryption_key = [System.Convert ]::ToBase64String((1 .. 32 | ForEach-Object { [byte ](Get-Random - Minimum 0 - Maximum 256 ) }))
703711 $git_secret_encrypted = Encrypt- GitSecret - key $encryption_key - plaintext $git_secret
704712 $docker_enc_params = " --git.secret=$git_secret_encrypted --encryption_key=$encryption_key "
705713 $docker_cmd += " ${docker_enc_params} "
706714
707- Write-Host " Use below as Gitlab and Github Webhook secret:"
715+ Write-Host " Use below as Gitlab and Github or Bitbucket Webhook secret:"
708716 Write-Host $git_secret_encrypted
709717 Write-Host
710718 }
Original file line number Diff line number Diff line change @@ -459,7 +459,7 @@ optional_params_cli=(
459459 " support_email"
460460)
461461
462- # Parameters that are required/optional in mode server
462+ # Parameters that are required/optional in the mode server
463463required_params_server=(
464464 " mode"
465465 " code_feedback"
@@ -720,16 +720,25 @@ encrypt_git_secret() {
720720
721721param_bito_access_key=" bito_cli.bito.access_key"
722722param_git_access_token=" git.access_token"
723+ param_git_provider=" git.provider"
723724
724725docker_enc_params=
725726if [ " $mode " == " server" ]; then
726727 if [ -n " ${props[$param_bito_access_key]} " ] && [ -n " ${props[$param_git_access_token]} " ]; then
727- git_secret=" ${props[$param_bito_access_key]} @#~^${props[$param_git_access_token]} "
728+ if [[ " ${props[$param_git_provider]} " == " BITBUCKET" ]]; then
729+ git_secret=" ${props[$param_git_access_token]} "
730+ # Truncate only for Bitbucket if longer than 60 characters
731+ if [ ${# git_secret} -gt 60 ]; then
732+ git_secret=" ${git_secret: 0: 60} "
733+ fi
734+ else
735+ git_secret=" ${props[$param_bito_access_key]} @#~^${props[$param_git_access_token]} "
736+ fi
728737 encryption_key=$( openssl rand -base64 32)
729738 git_secret=$( encrypt_git_secret " $encryption_key " " $git_secret " )
730739 docker_enc_params=" --git.secret=$git_secret --encryption_key=$encryption_key "
731740
732- echo " Use below as Gitlab and Github Webhook secret:"
741+ echo " Use below as Gitlab and Github or Bitbucket Webhook secret:"
733742 echo " $git_secret "
734743 echo
735744 fi
You can’t perform that action at this time.
0 commit comments