Skip to content

Commit

Permalink
go-mod-replace whitebox-controller dependencies
Browse files Browse the repository at this point in the history
To fix builds on Actions
  • Loading branch information
mumoshu committed Oct 29, 2020
1 parent 34f17a7 commit 46755a2
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 3 deletions.
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,11 @@ smoke: build
grep "Namespace to interact with" smoke2.log

rm -rf build/import-multi
VARIANT_BUILD_VER=v0.0.0 VARIANT_BUILD_REPLACE=$(shell pwd) PATH=${PATH}:$(GOBIN) ./variant export binary examples/advanced/import-multi build/import-multi
VARIANT_BUILD_VER=v0.0.0 \
VARIANT_BUILD_VARIANT_REPLACE=$(shell pwd) \
VARIANT_BUILD_MOD_REPLACE="github.com/summerwind/whitebox-controller@v0.7.1=github.com/mumoshu/whitebox-controller@v0.5.1-0.20201028130131-ac7a0743254b" \
PATH=${PATH}:$(GOBIN) \
./variant export binary examples/advanced/import-multi build/import-multi
build/import-multi foo baz HELLO > build/import-multi.log
bash -c 'diff <(echo HELLO) <(cat build/import-multi.log)'

Expand Down
3 changes: 2 additions & 1 deletion examples/advanced/import-multi/export.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ PROJECT_ROOT=../../..
VARIANT=${PROJECT_ROOT}/variant

export VARIANT_BUILD_VER=v0.33.3
export VARIANT_BUILD_REPLACE=$(pwd)/${PROJECT_ROOT}
export VARIANT_BUILD_VARIANT_REPLACE=$(pwd)/${PROJECT_ROOT}
export VARIANT_BUILD_MOD_REPLACE="github.com/summerwind/whitebox-controller@v0.7.1=github.com/mumoshu/whitebox-controller@v0.5.1-0.20201028130131-ac7a0743254b"

rm -rf ../exported
rm -rf ../compiled
Expand Down
17 changes: 16 additions & 1 deletion pkg/app/app_shim.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ func main() {
}
}

variantReplace := os.Getenv("VARIANT_BUILD_REPLACE")
variantReplace := os.Getenv("VARIANT_BUILD_VARIANT_REPLACE")
if variantReplace != "" {
_, err = app.execCmd(
Command{
Expand All @@ -175,6 +175,21 @@ func main() {
}
}

modReplace := os.Getenv("VARIANT_BUILD_MOD_REPLACE")
if modReplace != "" {
_, err = app.execCmd(
Command{
Name: "sh",
Args: []string{"-c", fmt.Sprintf("cd %s; go mod edit -replace %s", dstDir, modReplace)},
Env: map[string]string{},
},
true,
)
if err != nil {
return err
}
}

return nil
}

Expand Down

0 comments on commit 46755a2

Please sign in to comment.