From 9d7c02f52124b17fa9fe890dd9858ec06031640a Mon Sep 17 00:00:00 2001 From: Andrew Bayer Date: Thu, 24 Oct 2019 16:10:55 -0400 Subject: [PATCH] WIP: EXPERIMENT: Forcing a clone of boot config in boot-vault calling boot Issues like #5929 make me suspect that there are bugs that are encountered when `jx boot` needs to clone `jenkins-x-boot-config` rather than operating in an already-existing clone. So I'm trying to reproduce that here. Let's see what happens. Signed-off-by: Andrew Bayer --- jx/bdd/boot-vault/ci.sh | 11 ++++++----- pkg/cmd/boot/boot.go | 12 ++++++++++++ 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/jx/bdd/boot-vault/ci.sh b/jx/bdd/boot-vault/ci.sh index c8fc4d98d7..dd68ded4f2 100755 --- a/jx/bdd/boot-vault/ci.sh +++ b/jx/bdd/boot-vault/ci.sh @@ -41,17 +41,18 @@ export JX_VALUE_PROW_HMACTOKEN="$GH_ACCESS_TOKEN" # TODO temporary hack until the batch mode in jx is fixed... export JX_BATCH_MODE="true" -git clone https://github.com/jenkins-x/jenkins-x-boot-config.git boot-source -cp jx/bdd/boot-vault/jx-requirements.yml boot-source -cp jx/bdd/boot-vault/parameters.yaml boot-source/env +#git clone https://github.com/jenkins-x/jenkins-x-boot-config.git boot-source +mkdir -p boot-source/boot-overrides +cp jx/bdd/boot-vault/jx-requirements.yml boot-source/boot-overrides +cp jx/bdd/boot-vault/parameters.yaml boot-source/boot-overrides/env cd boot-source cp env/jenkins-x-platform/values.tmpl.yaml tmp.yaml -cat tmp.yaml ../boot-vault.platform.yaml > env/jenkins-x-platform/values.tmpl.yaml +cat tmp.yaml ../boot-vault.platform.yaml > boot-overrides/env/jenkins-x-platform/values.tmpl.yaml rm tmp.yaml cp env/prow/values.tmpl.yaml tmp.yaml -cat tmp.yaml ../boot-vault.prow.yaml > env/prow/values.tmpl.yaml +cat tmp.yaml ../boot-vault.prow.yaml > boot-overrides/env/prow/values.tmpl.yaml rm tmp.yaml # TODO hack until we fix boot to do this too! diff --git a/pkg/cmd/boot/boot.go b/pkg/cmd/boot/boot.go index 9c3e7e98d5..075bb42872 100644 --- a/pkg/cmd/boot/boot.go +++ b/pkg/cmd/boot/boot.go @@ -5,6 +5,7 @@ import ( "os" "path/filepath" + "github.com/jenkins-x/jx/pkg/helm" "github.com/jenkins-x/jx/pkg/versionstream" "github.com/jenkins-x/jx/pkg/boot" @@ -212,6 +213,17 @@ func (o *BootOptions) Run() error { if err != nil { return errors.Wrapf(err, "setting HEAD to %s", commitish) } + + // If there's already an existing "boot-overrides" directory, copy its contents into the repository. + existingOverridesDir := filepath.Join(o.Dir, "boot-overrides") + overridesExist, err := util.DirExists(existingOverridesDir) + if err == nil && overridesExist { + err = util.CopyDirOverwrite(existingOverridesDir, cloneDir) + if err != nil { + return err + } + } + o.Dir, err = filepath.Abs(cloneDir) if err != nil { return err