From e1e7167f424d6563d57ef90a5ca29d732db76fb1 Mon Sep 17 00:00:00 2001 From: Levi <141682181+levisingularity@users.noreply.github.com> Date: Tue, 19 Nov 2024 15:38:18 -0300 Subject: [PATCH] [#120]: Fix issues in the testing script after the release process (#121) * das-120: Fix issues in the testing script after the release process * Update release.sh --- scripts/deployment/release.sh | 7 +++---- scripts/deployment/tests.sh | 0 scripts/deployment/utils.sh | 26 +++++++++++++++++--------- scripts/deployment/workflow.sh | 0 4 files changed, 20 insertions(+), 13 deletions(-) mode change 100644 => 100755 scripts/deployment/tests.sh mode change 100644 => 100755 scripts/deployment/workflow.sh diff --git a/scripts/deployment/release.sh b/scripts/deployment/release.sh index 5da85bc..b774bb9 100755 --- a/scripts/deployment/release.sh +++ b/scripts/deployment/release.sh @@ -134,7 +134,7 @@ function create_release() { if process_package_dependencies "$package_name" "$package_dependencies"; then execute_hook_if_exists "BeforeRelease" "$package_hook_before_release" - cd - &>/dev/null + cd "$workdir" &>/dev/null local new_package="{\"package_name\": \"${package_name}\", \"current_version\": \"${package_version}\", \"new_version\": \"${new_package_version}\", \"repository_path\": \"${package_repository_folder}\", \"repository_owner\": \"${package_repo_owner}\", \"repository_name\": \"${package_repo_name}\", \"repository_workflow\": \"${package_workflow}\", \"repository_ref\": \"$package_repo_ref\"}" @@ -233,15 +233,14 @@ function main() { requirements "${required_commands[@]}" process_package_definitions "$definitions" review_and_apply_updates + empty_backup_answers if [[ "$exec_integration_tests" == true ]]; then print "Before starting the integration tests, it might be necessary to deploy the resources. To do this, use the command 'make deploy'" press_enter_to_continue - source "$workdir/scripts/deployment/tests.sh" + make integration-tests fi - - empty_backup_answers } diff --git a/scripts/deployment/tests.sh b/scripts/deployment/tests.sh old mode 100644 new mode 100755 diff --git a/scripts/deployment/utils.sh b/scripts/deployment/utils.sh index e2b5d3e..544821b 100755 --- a/scripts/deployment/utils.sh +++ b/scripts/deployment/utils.sh @@ -2,7 +2,6 @@ # PATHS workdir=$(pwd) -github_token_path="$workdir/scripts/deployment/gh_token" # GLOBAL VARIABLES colors=("reset" "red" "green" "blue" "yellow") @@ -147,8 +146,11 @@ function show_git_diff() { } function set_git_identity() { - local gh_user=$(gh api user | jq -r '.login') - local gh_email=$(gh api user/emails | jq -r '.[0].email') + local gh_user="" + local gh_email="" + + gh_user=$(gh api user | jq -r '.login') + gh_email=$(gh api user/emails | jq -r '.[0].email') print ":green:Setting git identity to $gh_user:$gh_email:/green:" git config user.name "$gh_user" @@ -166,7 +168,7 @@ function commit_and_push_changes() { set_git_identity - git add $files_to_add + git add "$files_to_add" git commit -m "$commit_msg" @@ -177,17 +179,23 @@ function commit_and_push_changes() { } function setup_gh_auth() { - local github_token=$(load_or_request_github_token "$github_token_path") - - gh auth login --web + if ! gh auth status >/dev/null 2>&1; then + gh auth refresh -h github.com -s user - gh auth setup-git + gh auth setup-git + else + local gh_user + gh_user=$(gh api user | jq -r '.login') + print ":yellow:User ${gh_user} is logged in:/yellow:" + fi } function clone_repo_to_temp_dir() { local package_repository="$1" local target_branch="${2:-master}" - local tmp_folder=$(mktemp -d) + local tmp_folder="" + + tmp_folder=$(mktemp -d) gh repo clone "$package_repository" "$tmp_folder" diff --git a/scripts/deployment/workflow.sh b/scripts/deployment/workflow.sh old mode 100644 new mode 100755