Conversation
|
/hold need some more work |
|
Ok I split out the enviroment variables, should be ok now |
sdake
left a comment
There was a problem hiding this comment.
looks like a good restructure of the existing Makefile (that has grown too unwieldy). Still, I can't help but think this will introduce unwanted side-effects and compound the difficulty of moving istio/istio to the container plan. Can you hold off on merging this work until istio/istio is on the container plan?
Cheers
-steve
/hold
files/Makefile
Outdated
| # Set up environment variables | ||
| $(shell mkdir -p out) | ||
| $(shell $(PWD)/common/scripts/setup_env.sh envfile > out/.env) | ||
| include out/.env |
There was a problem hiding this comment.
I don't understand this include. Why not simply pass the variables in this file? I am not keen on using filesystem contents in the top level Makefile.
There was a problem hiding this comment.
We need a way to have the environment setting consistent across the makefile and the shell script. This was the only way I could come up with this, but if there are better approaches I am all ears, I didn't feel great about this
There was a problem hiding this comment.
I don't have any immediate ideas, but I am beat after 5 hours of popcorn ceiling removal. Wow what a PITA. We can always adjust this in the future.
files/Makefile
Outdated
| ENV_VARS+=-e TAG="$(TAG)" | ||
| endif | ||
| RUN = ./common/scripts/run.sh | ||
| IMG ?= gcr.io/istio-testing/build-tools:master-2019-12-15T16-17-48 |
There was a problem hiding this comment.
The whole PR is out of date a bit, I'll rebase once we are ready to merge
There was a problem hiding this comment.
I am not sure why I have this IMG, it should just be defined in the script. Ill see if I can remove this one
files/Makefile
Outdated
| TIMEZONE=`readlink $(READLINK_FLAGS) /etc/localtime | sed -e 's/^.*zoneinfo\///'` | ||
| # Override variables with container specific | ||
| export TARGET_OUT=$(CONTAINER_TARGET_OUT) | ||
| export TARGET_OUT_LINUX=$(CONTAINER_TARGET_OUT_LINUX) |
There was a problem hiding this comment.
The introduction of CONTAINER_* variables seems confusing to me?
There was a problem hiding this comment.
The intent here was that we are defining thins like TARGET_OUT conditionally in the Makefile so we need to have both defined in the script -- no one other than Makefile uses the container_out though.
However, we can probably do the BUILD_WITH_CONTAINER check inside the script an remove the need for this
files/common/scripts/run.sh
Outdated
| -v /etc/passwd:/etc/passwd:ro \ | ||
| -v /etc/group:/etc/group:ro \ | ||
| $CONTAINER_OPTIONS \ | ||
| --env-file <(env | grep -v ${ENV_BLACKLIST}) \ |
| --mount "type=bind,source=${PWD},destination=/work" \ | ||
| --mount "type=volume,source=go,destination=/go" \ | ||
| --mount "type=volume,source=gocache,destination=/gocache" \ | ||
| ${CONDITIONAL_HOST_MOUNTS} \ |
There was a problem hiding this comment.
default CONDITIOANL_HOST_MOUNTS missing.
There was a problem hiding this comment.
Its in the environment setup script
| exit 1 | ||
| fi | ||
|
|
||
| export UID |
There was a problem hiding this comment.
where is UID set? Not in the environment:
sdake@beast-01:~/go/src/istio.io/istio$ env | grep UID
There was a problem hiding this comment.
Oh maybe this isn't right then. UID is a builtin I guess
$ env | grep UID
$ echo $UID
576696
There was a problem hiding this comment.
I'd verify the export works as expected. I would think it should as a built-in but best to be sure.
files/common/scripts/setup_env.sh
Outdated
| export CONTAINER_TARGET_OUT="${CONTAINER_TARGET_OUT:-/work/out/${TARGET_OS}_${TARGET_ARCH}}" | ||
| export CONTAINER_TARGET_OUT_LINUX="${CONTAINER_TARGET_OUT_LINUX:-/work/out/linux_amd64}" | ||
|
|
||
| export IMG="${IMG:-gcr.io/istio-testing/build-tools:master-2019-12-15T16-17-48}" |
There was a problem hiding this comment.
would be nice if we had one IMG variable to modify rather than two.
There was a problem hiding this comment.
ack, I think the other one can be removed
files/common/scripts/setup_env.sh
Outdated
|
|
||
| export CONTAINER_CLI="${CONTAINER_CLI:-docker}" | ||
|
|
||
| export ENV_BLACKLIST="${ENV_BLACKLIST:-^_\|PATH\|SHELL\|EDITOR\|TMUX\|USER\|HOME\|PWD\|TERM\|GO\|rvm\|SSH}" |
howardjohn
left a comment
There was a problem hiding this comment.
ill make the changes mentioned once we are on container plan for istio. This PR is a pain to rebase so I don't intend to keep it up to date until we are ready to merge
files/Makefile
Outdated
| # Set up environment variables | ||
| $(shell mkdir -p out) | ||
| $(shell $(PWD)/common/scripts/setup_env.sh envfile > out/.env) | ||
| include out/.env |
There was a problem hiding this comment.
We need a way to have the environment setting consistent across the makefile and the shell script. This was the only way I could come up with this, but if there are better approaches I am all ears, I didn't feel great about this
files/Makefile
Outdated
| ENV_VARS+=-e TAG="$(TAG)" | ||
| endif | ||
| RUN = ./common/scripts/run.sh | ||
| IMG ?= gcr.io/istio-testing/build-tools:master-2019-12-15T16-17-48 |
There was a problem hiding this comment.
The whole PR is out of date a bit, I'll rebase once we are ready to merge
| --mount "type=bind,source=${PWD},destination=/work" \ | ||
| --mount "type=volume,source=go,destination=/go" \ | ||
| --mount "type=volume,source=gocache,destination=/gocache" \ | ||
| ${CONDITIONAL_HOST_MOUNTS} \ |
There was a problem hiding this comment.
Its in the environment setup script
| exit 1 | ||
| fi | ||
|
|
||
| export UID |
There was a problem hiding this comment.
Oh maybe this isn't right then. UID is a builtin I guess
$ env | grep UID
$ echo $UID
576696
files/Makefile
Outdated
| ENV_VARS+=-e TAG="$(TAG)" | ||
| endif | ||
| RUN = ./common/scripts/run.sh | ||
| IMG ?= gcr.io/istio-testing/build-tools:master-2019-12-15T16-17-48 |
There was a problem hiding this comment.
I am not sure why I have this IMG, it should just be defined in the script. Ill see if I can remove this one
files/common/scripts/setup_env.sh
Outdated
| export CONTAINER_TARGET_OUT="${CONTAINER_TARGET_OUT:-/work/out/${TARGET_OS}_${TARGET_ARCH}}" | ||
| export CONTAINER_TARGET_OUT_LINUX="${CONTAINER_TARGET_OUT_LINUX:-/work/out/linux_amd64}" | ||
|
|
||
| export IMG="${IMG:-gcr.io/istio-testing/build-tools:master-2019-12-15T16-17-48}" |
There was a problem hiding this comment.
ack, I think the other one can be removed
files/Makefile
Outdated
| TIMEZONE=`readlink $(READLINK_FLAGS) /etc/localtime | sed -e 's/^.*zoneinfo\///'` | ||
| # Override variables with container specific | ||
| export TARGET_OUT=$(CONTAINER_TARGET_OUT) | ||
| export TARGET_OUT_LINUX=$(CONTAINER_TARGET_OUT_LINUX) |
There was a problem hiding this comment.
The intent here was that we are defining thins like TARGET_OUT conditionally in the Makefile so we need to have both defined in the script -- no one other than Makefile uses the container_out though.
However, we can probably do the BUILD_WITH_CONTAINER check inside the script an remove the need for this
|
Understood re difficulty of rebasing - especially against a moving target. I think BUILD_WITH_CONTAINER=1 PR is ready to merge. Once that is done, I'd suggest moving on this fast before more changes come to the TLD makefile in the common-files repo 😁 |
|
@howardjohn what do you want to do with this PR post 1.5 release? I think the make system is in sold enough shape that a script based approach can be used. Best to do that at the beginning of the dev cycle (after 1.5 work is done of course). Your thoughts welcome as I am listed as a reviewer. |
|
I would like to merge this in a similar form as it is today but have not
yet found the time to do so
…On Mon, Mar 2, 2020 at 11:19 PM Steven Dake ***@***.***> wrote:
@howardjohn <https://github.com/howardjohn> what do you want to do with
this PR post 1.5 release? I think the make system is in sold enough shape
that a script based approach can be used. Best to do that at the beginning
of the dev cycle (after 1.5 work is done of course).
Your thoughts welcome as I am listed as a reviewer.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#172?email_source=notifications&email_token=AAEYGXLROMBXASNTXW4LWZ3RFSVQJA5CNFSM4J6WNEG2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOENSL2ZA#issuecomment-593804644>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAEYGXOHSHUP2HG2BZOUSJTRFSVQJANCNFSM4J6WNEGQ>
.
|
|
If anyone else is interested feel free to take this over
…On Tue, Mar 3, 2020 at 8:17 AM John Howard ***@***.***> wrote:
I would like to merge this in a similar form as it is today but have not
yet found the time to do so
On Mon, Mar 2, 2020 at 11:19 PM Steven Dake ***@***.***>
wrote:
> @howardjohn <https://github.com/howardjohn> what do you want to do with
> this PR post 1.5 release? I think the make system is in sold enough shape
> that a script based approach can be used. Best to do that at the beginning
> of the dev cycle (after 1.5 work is done of course).
>
> Your thoughts welcome as I am listed as a reviewer.
>
> —
> You are receiving this because you were mentioned.
> Reply to this email directly, view it on GitHub
> <#172?email_source=notifications&email_token=AAEYGXLROMBXASNTXW4LWZ3RFSVQJA5CNFSM4J6WNEG2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOENSL2ZA#issuecomment-593804644>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/AAEYGXOHSHUP2HG2BZOUSJTRFSVQJANCNFSM4J6WNEGQ>
> .
>
|
This allows running the same set of logic for the script runs and makefile runs. It also allows non makefile users to source this and continue to run `go test ./...` or whatever they want, without duplicated logic.
|
I did not mean to merge this, I didn't realize it was approved. However, I do think it should be merge. If anyone disagrees we can revert or roll forward? |
I broke this in istio#172 because I forgot about the BUILD_WITH_CONTAINER=0 case... This should get things moving again. I have tested this in istio/istio#21951
Did the API change? Or there is probably an assumption that this is to run on Linux host? but FWIW $ BUILD_WITH_CONTAINER=1 make lint
/bin/sh: 1: set: Illegal option -o pipefail
common/Makefile.common.mk:33: recipe for target 'lint-yaml' failed
make[1]: *** [lint-yaml] Error 2
make: *** [Makefile:44: lint] Error 2$ BUILD_WITH_CONTAINER=1 make update-common
mkdir: cannot create directory '/var/folders': Permission denied
common/Makefile.common.mk:98: recipe for target 'update-common' failed
make[1]: *** [update-common] Error 1
make: *** [Makefile:44: update-common] Error 2$ BUILD_WITH_CONTAINER=1 make test
go: creating work dir: stat /var/folders/9j/nh3fxdf153v11vsjwtd1lf_800n1b6/T/: no such file or directory
Makefile.core.mk:23: recipe for target 'test' failed
make[1]: *** [test] Error 1
make: *** [Makefile:44: test] Error 2 |
* Add docker run script * Break out environment setup into a common script This allows running the same set of logic for the script runs and makefile runs. It also allows non makefile users to source this and continue to run `go test ./...` or whatever they want, without duplicated logic. * Fix lint * clean up (cherry picked from commit dfe763e)
* Add docker run script (#172) * Add docker run script * Break out environment setup into a common script This allows running the same set of logic for the script runs and makefile runs. It also allows non makefile users to source this and continue to run `go test ./...` or whatever they want, without duplicated logic. * Fix lint * clean up (cherry picked from commit dfe763e) * done (cherry picked from commit 0b5b799084d5654b1260fbb49a1f4c4c45389434) * Add TMPDIR to blocklist For OS X
Take over https://github.com/istio/common-files/pull/94/files
This makes it possible to run interactive commands inside the build container
resolves istio/istio#17476 - all commands arguments to run-docker.sh are passed
into the container
resolves istio/istio#17474 - the script will pass along a filtered picture of the host's environment to the container