Skip to content

Commit

Permalink
Merge branch 'main' into i4k-use-detected-terraform
Browse files Browse the repository at this point in the history
  • Loading branch information
i4ki committed Oct 19, 2023
2 parents 7225bd1 + 405e348 commit 26ddfd1
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 3 deletions.
5 changes: 2 additions & 3 deletions cmd/terramate/e2etests/create_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,9 +185,8 @@ func TestCreateStackIgnoreExistingFatalOnOtherErrors(t *testing.T) {

s := sandbox.New(t)
root := s.RootEntry()
root.CreateDir("stack")
// Here we fail stack creating with an access error
root.Chmod("stack", 0444)
root.CreateFile("stack", "")
// Here we fail stack creating because a file with the same name exists
cli := newCLI(t, s.RootDir())

assertRunResult(t, cli.run("create", "stack", "--ignore-existing"), runExpected{
Expand Down
19 changes: 19 additions & 0 deletions containers/test/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Copyright 2023 Terramate GmbH
# SPDX-License-Identifier: MPL-2.0

FROM golang:1.20-alpine3.16

RUN apk add --no-cache git gcc g++

# Needed for go test -race
ENV CGO_ENABLED=1

WORKDIR /build
COPY go.mod .
COPY go.sum .
RUN go mod download

COPY . .

RUN --mount=type=cache,target=/root/.cache/go-build \
go test -race -count=1 -v ./cmd/terramate/e2etests
5 changes: 5 additions & 0 deletions makefiles/common.mk
Original file line number Diff line number Diff line change
Expand Up @@ -162,3 +162,8 @@ help:
} \
} \
{ lastLine = $$0 }' $(MAKEFILE_LIST)

## run tests within docker
.PHONY: docker/test
docker/test:
docker build --rm -f containers/test/Dockerfile .
15 changes: 15 additions & 0 deletions makefiles/unix.mk
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,21 @@ GO_BUILD_FLAGS=--ldflags '-extldflags "-static"'
BUILD_ENV=CGO_ENABLED=0
EXEC_SUFFIX=

GIT_MIN_MAJOR_VERSION=2
GIT_MIN_MINOR_VERSION=28
GIT_MIN_VERSION=$(GIT_MIN_MAJOR_VERSION).$(GIT_MIN_MINOR_VERSION).0
GIT_CURRENT_VERSION=$(shell git --version | grep ^git | cut -d' ' -f3)
GIT_CURRENT_MAJOR_VERSION=$(shell echo $(GIT_CURRENT_VERSION) | cut -d. -f1)
GIT_CURRENT_MINOR_VERSION=$(shell echo $(GIT_CURRENT_VERSION) | cut -d. -f2)

IS_VALID_GIT_VERSION=$(shell expr $(GIT_CURRENT_MAJOR_VERSION) '>=' $(GIT_MIN_MAJOR_VERSION) '&' $(GIT_CURRENT_MINOR_VERSION) '>=' $(GIT_MIN_MINOR_VERSION))


ifneq "$(IS_VALID_GIT_VERSION)" "1"
$(error "$(IS_VALID_GIT_VERSION) Unsupported git version $(GIT_CURRENT_VERSION). Minimum supported version: $(GIT_MIN_VERSION)")
endif


## build a test binary -- not static, telemetry sent to localhost, etc
.PHONY: test/build
test/build: test/fakecloud
Expand Down

0 comments on commit 26ddfd1

Please sign in to comment.