#build-harness

build-harness

Archived
0224

Help with the Cloud Posse build-harness https://github.com/cloudposse/build-harness

erik
erikover 1 year ago
archived the channel
Hans D
Hans Dover 2 years ago
Want to see if we can get a more abstract version of
## Run tests in docker container
docker/test:
	docker run --name terratest --rm -it -e GITHUB_TOKEN \
		-e AWS_ACCESS_KEY_ID -e AWS_SECRET_ACCESS_KEY -e AWS_SESSION_TOKEN -e AWS_ENDPOINT_URL \
		-e PATH="/usr/local/terraform/bin:/go/bin:/usr/local/go/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" \
		-v $(CURDIR)/../../:/module/ cloudposse/test-harness:latest -C /module/test/src test

in the build (or test?) harness (and some other magic here as well).
What would be the best place to add it? as it involves docker, aws and terraform
Jeremy G (Cloud Posse)
Jeremy G (Cloud Posse)over 2 years ago
Most Cloud Posse projects install build-harness under the project's repository root to manage things like building Docker images or generating README.md from README.yaml. In turn, build-harness installs some tools it needs when it needs them. We had been using INSTALL_PATH to determine where build-harness installs its tools, intending that they be installed under the build-harness tree, but this is in conflict with Geodesic, which uses INSTALL_PATH to determine where to install the Geodesic wrapper/command. This was causing build-harness to install gomplate in /usr/local/bin , which was not the intention.

So we changed build-harness to install its tools into PACKAGES_INSTALL_PATH instead. Unfortunately, this broke some workflows, particularly pre-commit workflows, which use INSTALL_PATH to direct where build-harness installs tools needed for the workflow. The quick fix is to replace INSTALL_PATH with PACKAGES_INSTALL_PATH in the workflow where the intent is to have build-harness install tools in a particular directory.
Jeremy G (Cloud Posse)
Jeremy G (Cloud Posse)over 3 years ago
@Erik Osterman (Cloud Posse) @Andriy Knysh (Cloud Posse) FYI, for about 22 hours yesterday, make packages/install was broken and either errored out (if run with /bin/sh) or claimed the package was no longer supported. ☝️ Anyone reporting such errors during that time period should simply be advised to try it again.
johncblandii
johncblandiiover 3 years ago
did something change with make packages/install/terraform-docs?
Jeremy G
Jeremy Gover 3 years ago
@Jeremy G has joined the channel
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 3 years ago
azec
azecover 4 years ago
Hi!
I was about to build some Spacelift images using docker targets from build-harness.
It all works locally. However, trying to setup GitLab CI/CD Pipeline and first thing that I learn is that we don't have GitLab Runner with shell executor. It is also not supported path (internally in company) to have EC2 node hosting GitLab Runner and using bash as shell executor to build Docker images using docker.
Our GitLab Runner is Kubernetes runner, which means GitLab CI/CD jobs run in K8S pods. Since this necessitates to use Docker-in-Docker, the recommended approach for building images from Dockerfiles is to use kaniko. This happens also to be one of the recommended approaches by GitLab as described in their docs here.

I am curious if there was ever interest in adding kaniko targets to build-harness?
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 4 years ago
@here critical update - <http://git.io|git.io> deprecation 2022-04-29 means that build-harness links may stop working.

https://github.com/cloudposse/build-harness/issues/314
David Schmidt
David Schmidtalmost 5 years ago
Hello, good Build Harness folks - I was wondering if there was any thought given to renaming the default branch from master to main in GitHub? We’re planning to move our build-harness-extensions project that way, so the thought occurred to check with the mothership. Thanks!
Slackbot
Slackbotover 5 years ago
This message was deleted.
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)about 6 years ago
Haven’t seen that error but I think you are right! Maybe a newer version of awk warns
nick
nickabout 6 years ago
Anyone else get the following when running make commands (help is a good example)

Available targets:

awk: cmd. line:1: warning: regexp escape sequence `\_' is not a known regexp operator

GNU Awk 5.1.0, API: 3.0 (GNU MPFR 4.1.0, GNU MP 6.2.0)

Looks like the awk regex in has an escaped _ which I'm not sure is needed ( https://github.com/cloudposse/build-harness/blob/master/Makefile.helpers#L57 )

@awk '/^[a-zA-Z\_0-9%:\\\/-]+:/
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 6 years ago(edited)
I'm ecstatic about our new assert-set and assert-unset macros. They are now in entirely in native make so and report line numbers where variable now unset or set.
Chris Barlock
Chris Barlockover 6 years ago
I'm stumped.  I have a little make file:

GO ?= $(shell which go 2>/dev/null)
GOEXT_TMP_DIR := $(shell pwd -P)/tmp

.PHONY: test
test:
	export GOPATH=$(GOEXT_TMP_DIR) && \
	$(GO) get -u <http://github.com/securego/gosec/cmd/gosec|github.com/securego/gosec/cmd/gosec>


This go get command is supposed to get the source files for this gosec tool, build it and install the binary to $GOPATH/bin.  It works fine:

romulus:cicd-test cbarlock$ make -f test.mak
export GOPATH=/Users/cbarlock/vscode/cicd-test/tmp && \
	/usr/local/go/bin/go get -u <http://github.com/securego/gosec/cmd/gosec|github.com/securego/gosec/cmd/gosec>
romulus:cicd-test cbarlock$ ls tmp
bin	src
romulus:cicd-test cbarlock$ ls tmp/bin
gosec


But when I run the same target as a build harness extension:

romulus:cicd-test cbarlock$ make test
export GOPATH=/Users/cbarlock/vscode/cicd-test/tmp && \
	/usr/local/go/bin/go get -u <http://github.com/securego/gosec/cmd/gosec|github.com/securego/gosec/cmd/gosec>
romulus:cicd-test cbarlock$ ls tmp
src


Only the source files are downloaded and the binary is not created.  Any ideas why this is happening?
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 6 years ago
Adding @U010XGY9B46 bot
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 6 years ago
This is probably why we don’t see it
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 6 years ago
Consider using a Docker container instead for build-harness?
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 6 years ago
@David Schmidt makes sense, but first we have heard of it.
David Schmidt
David Schmidtover 6 years ago
We have a number of teams (10-ish) running a number of PR builds daily through Travis - all of which are hitting github for the build-harness as well as a repo of extensions we built. I’m finding that we hit rate limiting pretty easily if we do unauthenticated curls to get the build-harness bootstrapped unless we use a github user and token. Since this differs from the nominal bootstrapping process, I wonder if others have hit a similar situation?
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 6 years ago
@UUB28NLDS help keep tabs! 😉
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)almost 7 years ago
your workaround is good for now! 😃
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)almost 7 years ago
@Andrew Mackett seems like we have some bug in build-harness - others too have had problems with it not installing gomplate or not being installed in the right place
Andrew Mackett
Andrew Mackettalmost 7 years ago
The problem was gomplate not being found. I thought that was being installed in the make readme/deps step but perhaps I have an issue with my $GOPATH or something like that.

Anyway, using brew install gomplate fixed the situation and make readme worked fine after that. Thanks for the help!
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)almost 7 years ago
@Andriy Knysh (Cloud Posse) is...
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)almost 7 years ago
(also, we're working on a GitHub action to eliminate this!)
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)almost 7 years ago
can you try make readme/init
Andrew Mackett
Andrew Mackettalmost 7 years ago
Hi all. I’m having an issue when running make readme for a PR on cloudposse/terraform-aws-vpc-flow-logs-s3-bucket

make readme
curl --retry 3 --retry-delay 5 --fail -sSL -o /Users/andrewmackett/git/terraform-aws-vpc-flow-logs-s3-bucket/build-harness/vendor/terraform-docs <https://github.com/segmentio/terraform-docs/releases/download/v0.4.5/terraform-docs-v0.4.5-darwin-amd64> && chmod +x /Users/andrewmackett/git/terraform-aws-vpc-flow-logs-s3-bucket/build-harness/vendor/terraform-docs
make: gomplate: No such file or directory
make: *** [readme/build] Error 1

Any suggestions?

More detail here:
https://github.com/cloudposse/terraform-aws-vpc-flow-logs-s3-bucket/pull/4#issuecomment-575714601
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)almost 7 years ago
I need to update our package for that
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)almost 7 years ago
Awesome!
cytopia
cytopiaalmost 7 years ago
I have successfully tried v0.8-rc.2 . Works pretty well. Seems to handle every case out-of-the-box that came up as GitHub issues with the awk version.
cytopia
cytopiaalmost 7 years ago(edited)
v0.8.0-rc.1 does (also haven't tested yet)
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)almost 7 years ago
(i haven't tested it yet)
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)almost 7 years ago
@cytopia doesn't the official terraform-docs now support HCl2?
cytopia
cytopiaalmost 7 years ago
@Erik Osterman (Cloud Posse) there's another commit added to the terraform-docs PR which handles multiline description heredoc text.
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)almost 7 years ago
No, or at least not maintained. We use #helmfile for deploying charts
deftunix
deftunixalmost 7 years ago
Hi all, do you have in build-harness any switch to deploy helm charts?
deftunix
deftunixalmost 7 years ago
@deftunix has joined the channel
Can Kutlu Kinay
Can Kutlu Kinayalmost 7 years ago
@Can Kutlu Kinay has joined the channel
curious deviant
curious deviantalmost 7 years ago
@curious deviant has joined the channel
Tertius Stander
Tertius Standeralmost 7 years ago
@Tertius Stander has joined the channel
Eugene
Eugenealmost 7 years ago
@Eugene has joined the channel
Kostis (Codefresh)
Kostis (Codefresh)almost 7 years ago
@Kostis (Codefresh) has joined the channel
Taras
Tarasalmost 7 years ago
@Taras has joined the channel
Roderik van der Veer
Roderik van der Veeralmost 7 years ago
@Roderik van der Veer has joined the channel
Taylor
Tayloralmost 7 years ago
@Taylor has joined the channel
Andriy Knysh (Cloud Posse)
Andriy Knysh (Cloud Posse)almost 7 years ago
and yes, I tried it many times, works (with TF 0.12 binary and 0.12 version of the module, master branch)
Andriy Knysh (Cloud Posse)
Andriy Knysh (Cloud Posse)almost 7 years ago
yes try in geodesic
Igor
Igoralmost 7 years ago
I am guessing if I run geodesic, it would be more likely to work as well, right?