diff --git a/CHANGELOG.md b/CHANGELOG.md index 9c17067..4ba6dc5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,8 +8,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) ### Changed ### Deprecated ### Removed -- Logging errors from security commands +- Logging errors from security command ### Fixed +- GHORG_RECLONE_PATH from getting unset ### Security ## [1.8.8] - 10/11/22 diff --git a/cmd/reclone.go b/cmd/reclone.go index 2dc5c44..ed1f3cc 100644 --- a/cmd/reclone.go +++ b/cmd/reclone.go @@ -146,8 +146,8 @@ func runReClone(rc ReClone) { env := keyValue[0] ghorgEnv := strings.HasPrefix(env, "GHORG_") - // skip global flags - if env == "GHORG_COLOR" || env == "GHORG_CONFIG" || env == "GHORG_RECLONE_VERBOSE" || env == "GHORG_RECLONE_QUIET" { + // skip global flags and reclone flags which are set in the conf.yaml + if env == "GHORG_COLOR" || env == "GHORG_CONFIG" || env == "GHORG_RECLONE_VERBOSE" || env == "GHORG_RECLONE_QUIET" || env == "GHORG_RECLONE_PATH" { continue } if ghorgEnv { diff --git a/scripts/github_cloud_integration_tests.sh b/scripts/github_cloud_integration_tests.sh index 31b8d64..8f9c78d 100755 --- a/scripts/github_cloud_integration_tests.sh +++ b/scripts/github_cloud_integration_tests.sh @@ -8,6 +8,7 @@ cp ./ghorg /usr/local/bin GITHUB_ORG=forcepushtoproduction GHORG_TEST_REPO=ghorg-ci-test +REPO_WITH_TESTING_TOPIC=ghorg-repo-with-topic-of-testing ghorg version @@ -66,3 +67,47 @@ fi # Move back to original conf but keep updated_conf if we want to use it again mv $HOME/.config/ghorg/conf.yaml $HOME/.config/ghorg/updated_conf.yaml mv $HOME/.config/ghorg/conf-bak.yaml $HOME/.config/ghorg/conf.yaml + +# RECLONE BASIC + +# hack to allow sed to be ran on both mac and ubuntu +sed "s/XTOKEN/${GITHUB_TOKEN}/g" $PWD/scripts/testing_confs/reclone-basic.yaml > $PWD/scripts/testing_confs/updated_reclone.yaml + +ghorg reclone --reclone-path=$PWD/scripts/testing_confs/updated_reclone.yaml --verbose + +if [ -e /tmp/testing_reclone_with_tag/$REPO_WITH_TESTING_TOPIC ] +then + echo "Pass: github reclone testing-topic-in-tmp-dir file exists" +else + echo "Fail: github reclone testing-topic-in-tmp-dir file does not exist" + exit 1 +fi + +COUNT=$(ls /tmp/testing_reclone_with_tag | wc -l) + +if [ "${COUNT}" -eq 1 ] +then + echo "Pass: github reclone testing_reclone_with_tag" +else + echo "Fail: github reclone testing_reclone_with_tag too many files found" + exit 1 +fi + +if [ -e /tmp/all-repos/$REPO_WITH_TESTING_TOPIC ] +then + echo "Pass: github reclone all-repos" +else + echo "Fail: github reclone all-repos" + exit 1 +fi + +COUNT=$(ls /tmp/all-repos | wc -l) + +if [ "${COUNT}" -ge 3 ] +then + echo "Pass: github reclone all-repos count" +else + echo "Fail: github reclone all-repos count too low" + exit 1 +fi + diff --git a/scripts/testing_confs/reclone-basic.yaml b/scripts/testing_confs/reclone-basic.yaml new file mode 100644 index 0000000..343a281 --- /dev/null +++ b/scripts/testing_confs/reclone-basic.yaml @@ -0,0 +1,5 @@ +testing_reclone_with_tag: + cmd: "ghorg clone forcepushtoproduction --token=XTOKEN --output-dir=testing_reclone_with_tag --topics=testing --path=/tmp" + +all-repos: + cmd: "ghorg clone forcepushtoproduction --token=XTOKEN --output-dir=all-repos --path=/tmp"