feat: Add ability to use custom terraform version#2942
Conversation
6cd90c9 to
072ca8f
Compare
Updated all terraform actions and base "run" action to support specifying a custom version of terraform cli. Signed-off-by: Brittan DeYoung <32572259+brittandeyoung@users.noreply.github.com>
072ca8f to
6d9fc57
Compare
We should always default to a specific version of Terraform, otherwise users of this package may be surprised with new behaviour introduced in a future latest version. Requiring everyone that uses this package to default to a version sounds like a lot of busy work. Signed-off-by: Gerhard Lazu <gerhard@lazu.co.uk>
58c0e14 to
acddbba
Compare
There was a problem hiding this comment.
This looks good to me - ready to merge. WDYT @marcosnils @jpadams?
Does it still work as expected for you @brittandeyoung after my changes?
Signed-off-by: Brittan DeYoung <32572259+brittandeyoung@users.noreply.github.com>
55a36a5 to
20e8536
Compare
|
@gerhard I am confused as to why there needs to be a default version specified in @marcosnils Good catch! I have moved the input for version to the |
|
Additionally I would like to get thoughts on making the default version Having this as |
thx for updating this 🙌. I just realized that the reason that we didn't catch this in the tests is because we're not currently testing it. WDYT if we add the following action to also test the imageWorkflow: {
// Set a terraform version for testing specific version of terraform
_image: docker.#Pull & {
source: "hashicorp/terraform"
}
init: terraform.#Init & {
container: #input: _image.output
source: tfSource.output
}
workspaceNew: terraform.#Workspace & {
container: #input: _image.output
source: init.output
subCmd: "new"
name: "TEST_WORKSPACE"
}
plan: terraform.#Plan & {
container: #input: _image.output
source: init.output
}
apply: terraform.#Apply & {
container: #input: _image.output
always: true
source: plan.output
}
verify: #AssertFileRegex & {
input: apply.output
path: "terraform.tfstate"
regex: string | *"1\\.2\\.7"
}
destroy: terraform.#Destroy & {
container: #input: _image.output
source: apply.output
container: #input: _image.output
}
}
I agree that having |
c9cd7ef to
2e11890
Compare
|
@marcosnils New test workflow has been added as suggested. I have also opened #2951 to start the discussion of using |
Signed-off-by: Brittan DeYoung <32572259+brittandeyoung@users.noreply.github.com>
2e11890 to
c6e4d1f
Compare
Signed-off-by: Brittan DeYoung <32572259+brittandeyoung@users.noreply.github.com>
|
The Universe Tests were exceeding the git hub actions timeout value specified, So I increased it. |
They shouldn't: in general, it times out when bats fails unproperly and a zombie continues to live whenever it shouldn't. |
|
@grouville Unfortunately I am unable to run all the tests locally as I use a M1 Mac. There are tests that rely on docker images that do not have an arm based image. I have been relying on targeting the specific tests I am modifying locally. |
|
@grouville I have seen the Universe test run for close to 23 minutes in past PRs. With tests being added, it would not surprise me if it takes longer than 30 min to run in a PR. This is why I bumped the timeout to test on this PR. |
|
Thank you @brittandeyoung for sticking with this! I have a few local changes which I am yet to push, but for now it's more important to address the existing comments in reverse order, starting with the most recent one first (bottom to top). Here comes the first one:
This is a symptom of the shared networking available on the free GitHub Actions tier combined with the variable performance of the GitHub Actions Cache. Locally, these tests consistently take less than 2 minutes to run. Here is my last run: Instead of increasing the timeout, a better fix is to disable the GitHub Actions Caching. This will result in more consistent durations, which currently are around the 15 mins mark. This fix is already in My recommendation is to rebase this branch and drop the timeout increase commit. Moving onto the next comment. |
Updated all terraform actions and base "run" action to support specifying a custom version of terraform cli. Signed-off-by: Brittan DeYoung <32572259+brittandeyoung@users.noreply.github.com>
We should always default to a specific version of Terraform, otherwise users of this package may be surprised with new behaviour introduced in a future latest version. Requiring everyone that uses this package to default to a version sounds like a lot of busy work. Signed-off-by: Gerhard Lazu <gerhard@lazu.co.uk>
Signed-off-by: Brittan DeYoung <32572259+brittandeyoung@users.noreply.github.com>
Signed-off-by: Brittan DeYoung <32572259+brittandeyoung@users.noreply.github.com>
Signed-off-by: Brittan DeYoung <32572259+brittandeyoung@users.noreply.github.com>
…young/dagger into feat/terraform-version Signed-off-by: Brittan DeYoung <32572259+brittandeyoung@users.noreply.github.com>
This reverts commit a782b7d. Signed-off-by: Brittan DeYoung <32572259+brittandeyoung@users.noreply.github.com>
428ee1e to
7b4b7c0
Compare
|
@gerhard I have pulled the latest from |
I do not use Docker for Mac since this is 8x slower than the Linux equivalent. FTR: https://docs.dagger.io/1200/local-dev I personally run Docker on Linux & use Knowing the 8x slowdown, would it still be worth to you for us to invest time in getting these tests to work on Docker for Mac ARM? |
Thank you very much! That was going to be my suggestion too since this is slowly snowballing and I am keen on us getting it merged. |
|
@gerhard Thanks for the tips on running it remotely on a linux host. I do not feel these tests need to be "fixed". The examples are the powershell action. The docker image simply does not have a arm64 option. This will likely be the case for a long time. I will work on getting a dev environment using the remote |
🙌🏻
The simplest thing that I can think of is to disable those tests if the platform is not |
I think that might help for tests unrelated. But if the user is modifying this action, I think it would be better for them to get an error when running tests locally then it simply not running them. Maybe there should be some documentation indicating potential issues running tests on ARM platforms instead? |
Good point. I believe that is the case currently.
I would much rather we made these tests work for ARM. I don't know if we can add a Powershell |
|
It looks like Running this locally now, with an empty cache. |
|
Passes locally (Linux Re-triggered the GitHub Action for now - not holding my breath. This is my last update in this time-box. I might be able to resume later on today, otherwise tomorrow. My takeaway from this session is that my task to provision a dedicated Docker Engine / GitHub Actions Runner just jumped to the top of my list. These tests should finish in less than 2 minutes. We are wasting a lot of time by not having this. Leaving it here for now. fyi @aluzzardi @samalba @shykes |
|
I continued digging into the Notice that we blow past the 4GB limit, start swapping, and then everything slows down to a crawl. While this host is limited to 4GB and the free GitHub Actions Runner has 7GB, I suspect that we are seeing the same issue in GitHub Actions.
Next step is to run |
|
The above confirms that bumping the timeout to Before I bump the RAM to 8GB, I am curious what happens if I lower the number of parallel Because we currently run 4 in parallel (meaning 4 |
|
Even with And after Since the GitHub Actions Runner has 7GB, I am going to bump my test host to 8GB and try again. |
Instead of adopting multiple approaches, stick to a single one. Signed-off-by: Gerhard Lazu <gerhard@lazu.co.uk> Signed-off-by: Gerhard Lazu <gerhard@lazu.co.uk>
When `dagger do test integration universe` runs, each job can use up to 1GB of RAM. There is an extra top-level job that spikes up to 3GB of RAM. Combined, they exceed the 7GB free GitHub Actions Runner limit. When this happens, the host starts swapping, everything slows down to a crawl, and eventually the 30 minutes action limit gets exceeded and the job gets cancelled. The best approach right now seems to not parallelize by default. The total time saving is insignificant - 20s for a >600s total in my test. dagger#2942 has more details (including lots of screenshots). Signed-off-by: Gerhard Lazu <gerhard@lazu.co.uk>
9f46ab9 to
23530f3
Compare
|
Not running multiple universe tests in parallel should keep the memory utilisation within the free GitHub Actions runner resources. Each job can use up to 1GB of RAM, and the top-level one that orchestrates all the jobs can use up to 3GB of RAM. This hits the 7GB limit, the runner starts swapping, everything slows down to a crawl, and eventually the While the last commit makes the Experimental Universe Tests slower ( There is a lot more that I discovered since I started looking at this. For now, this improves things enough to get this change merged. I intend to continue digging into this test-related / GitHub Actions issue next week. cc @aluzzardi @samalba @shykes Thank you @brittandeyoung for your contribution & sticking with us as we pushed this through. If we did it right, your next contribution should be easier 😎 Leaving another screenshot for the Universe Tests issue here: |












Updated all terraform actions and base "run" action to support specifying a custom version of terraform cli.