Skip to content

Commit

Permalink
Merge pull request #8 from catenasys/feature/update-build
Browse files Browse the repository at this point in the history
update to most recent build patterns
  • Loading branch information
scealiontach authored Jul 8, 2021
2 parents 8aabc46 + 75c508c commit c2c6355
Show file tree
Hide file tree
Showing 6 changed files with 251 additions and 198 deletions.
14 changes: 7 additions & 7 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ default_language_version:
python: python3
repos:
- repo: https://github.com/commitizen-tools/commitizen
rev: v2.13.0
rev: v2.17.12
hooks:
- id: commitizen
stages: [commit-msg]
Expand All @@ -25,7 +25,7 @@ repos:
- id: pmd
exclude: ".*/src/test/.*"
- repo: https://github.com/jumanjihouse/pre-commit-hooks
rev: 2.1.4
rev: 2.1.5
hooks:
- id: forbid-binary
exclude: ".*.(png|jpg|jpeg)$"
Expand All @@ -48,11 +48,11 @@ repos:
hooks:
- id: markdownlint_docker
- repo: https://github.com/pre-commit/mirrors-eslint
rev: v7.17.0
rev: v7.30.0
hooks:
- id: eslint
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.4.0
rev: v4.0.1
hooks:
- id: check-added-large-files
- id: check-case-conflict
Expand All @@ -73,7 +73,7 @@ repos:
hooks:
- id: checkmake
- repo: https://github.com/Lucas-C/pre-commit-hooks
rev: v1.1.9
rev: v1.1.10
hooks:
- id: forbid-tabs
exclude: "^(Makefile|.*.mk|.*.go)$"
Expand All @@ -89,12 +89,12 @@ repos:
- id: fmt
- id: cargo-check
- repo: https://github.com/adrienverge/yamllint
rev: v1.25.0
rev: v1.26.1
hooks:
- id: yamllint
exclude: ".*/templates/.*"
- repo: https://github.com/IamTheFij/docker-pre-commit
rev: v2.0.0
rev: v2.0.1
hooks:
- id: docker-compose-check
- id: docker-compose-check
Expand Down
13 changes: 2 additions & 11 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,5 @@
FROM golang:1.16-alpine as builder
RUN apk update && \
apk upgrade && \
apk add \
bash \
gcc
COPY . /tmp/catenasys/sxtctl
WORKDIR /tmp/catenasys/sxtctl
RUN bash ./scripts/build

FROM scratch
WORKDIR /
COPY --from=builder /tmp/catenasys/sxtctl/target /target

COPY ./target /target
ENTRYPOINT ["/target/sxtctl-linux-amd64"]
9 changes: 6 additions & 3 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,12 @@ pipeline {
expression { env.BRANCH_NAME == "master" }
}
steps {
sh '''
make clean publish
'''
withCredentials([string(credentialsId: 'btp-build-github-pat',
variable: 'GITHUB_TOKEN')]) {
sh '''
make clean publish
'''
}
}
}
}
Expand Down
30 changes: 15 additions & 15 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
MAKEFILE_DIR := $(dir $(lastword $(MAKEFILE_LIST)))
include $(MAKEFILE_DIR)/standard_defs.mk

clean: clean_go
clean: clean_build_go

distclean: clean_docker

build: $(MARKERS)/build_docker
build: $(MARKERS)/build_go $(MARKERS)/build_docker

analyze: analyze_fossa
test: $(MARKERS)/test_go

.PHONY: build_dev
build_dev:
(cd ./cmd/sxtctl && go build .)
analyze: analyze_go analyze_fossa

$(MARKERS)/build_go: $(MARKERS)/build_toolchain_docker
$(TOOL) -w /project/cmd/sxtctl $(TOOLCHAIN_IMAGE) go build
publish: gh-create-draft-release
if [ "$(RELEASABLE)" = "yes" ]; then \
$(GH_RELEASE) upload $(VERSION) target/* ; \
fi

.PHONY: clean_go
clean_go: $(MARKERS)/build_toolchain_docker
$(TOOL) $(TOOLCHAIN_IMAGE) go clean
.PHONY: clean_docker
clean_docker: clean_toolchain_docker
docker rmi -f sxtctl:$(ISOLATION_ID)

$(MARKERS)/build_docker:
$(MARKERS)/build_docker: $(MARKERS)/build_go
docker build -t sxtctl:$(ISOLATION_ID) .
touch $@

.PHONY: clean_docker
clean_docker: clean_toolchain_docker
docker rmi -f sxtctl:$(ISOLATION_ID)
.PHONY: analyze_dive
analyze_dive:
$(DIVE_ANALYZE) sxtctl:$(ISOLATION_ID)
2 changes: 1 addition & 1 deletion scripts/build
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export CGO_ENABLED=0
export GO111MODULE=on
rm -rf "$TARGETDIR"
mkdir -p "$TARGETDIR"
for ARCH in "darwin-amd64" "darwin-arm64" "linux-amd64" "windows-amd64"; do
for ARCH in "darwin-amd64" "linux-arm64" "darwin-arm64" "linux-amd64" "windows-amd64"; do
echo "building sxtctl-$ARCH"
IFS='-' read -r -a arArch <<<$ARCH
export GOOS=${arArch[0]}
Expand Down
Loading

0 comments on commit c2c6355

Please sign in to comment.