Update reclone command to skip more envs (#253)

This commit is contained in:
Jay Gabriels
2022-10-22 16:56:27 -07:00
committed by GitHub
parent ea5cb993d3
commit 793143ef33
4 changed files with 54 additions and 3 deletions

View File

@@ -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

View File

@@ -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 {

View File

@@ -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

View File

@@ -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"