Skip to content

Commit

Permalink
Support architecture targeted builds (#837)
Browse files Browse the repository at this point in the history
This reworks much of the Makefile and, to a lesser extent, the
Dockerfiles for building the CNI plugins for other platforms.

Additional clean up work is included as well as this was combed
through to support these builds.

Including:

- ARCH resolver to identify the ARCH (GOARCH styled) to pass around
- Updated ARCH and GOARCH references throughout to support
  against other ARCHes
- Make base container build appropriately for ARCH
  - Docker explicit multiarch references in targets and Dockerfiles
  - Updated related container images to allow testing where possible
- Eliminate ./tmp usage with tar unpacking from a pipe
- Clean up and consistent call sites all around
   - Reconciled image naming
   - Updated stale golang images references
- Added docstrings for reference
  • Loading branch information
jahkeup authored and mogren committed Apr 20, 2020
1 parent 056c5f8 commit fbe76f7
Show file tree
Hide file tree
Showing 7 changed files with 254 additions and 144 deletions.
38 changes: 29 additions & 9 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,46 @@ orbs:
aws-cli: circleci/aws-cli@0.1.19
k8s: circleci/kubernetes@0.11.0

jobs:
build:
references:
build_job: &build
docker:
- image: circleci/golang:1.13-stretch
working_directory: /go/src/github.com/{{ORG_NAME}}/{{REPO_NAME}}
environment:
environment: &env
GO111MODULE: "on"
steps:
- checkout
- run: go get -u golang.org/x/lint/golint
- run: go get -u golang.org/x/tools/cmd/goimports
- run: make check-format
- run: make build-linux
- run: make lint
- run: make build-linux "ARCH=$ARCH"
# TODO: Make lint a hard-check once baselined
- run: make lint LINT_FLAGS=
- run: make vet
- run: make unit-test
# TODO: Enable architecture specific unit-test when Circle CI supports it!
- run: make unit-test ARCH=amd64

jobs:
build_x86_64:
<<: *build
environment:
<<: *env
# Target the GOARCH for x86_64
ARCH: amd64

build_aarch64:
<<: *build
environment:
<<: *env
# Target the GOARCH for aarch64
ARCH: arm64

integration_test:
docker:
- image: circleci/golang:1.13-stretch
working_directory: /go/src/github.com/{{ORG_NAME}}/{{REPO_NAME}}
environment:
GO111MODULE: "on"
<<: *env
RUN_CONFORMANCE: "true"
steps:
- checkout
Expand All @@ -47,11 +65,13 @@ workflows:
version: 2
check:
jobs:
- build
- build_x86_64
- build_aarch64
- hold:
type: approval
requires:
- build
- build_x86_64
- build_aarch64
- integration_test:
requires:
- hold
Expand Down
4 changes: 3 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
aws-cni
aws-k8s-agent
cni-metrics-helper
grpc-health-probe
portmap
cni-metrics-helper/cni-metrics-helper
routed-eni-cni-plugin
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ verify-network
.idea/
*.iml
.DS_Store
cni-metrics-helper/cni-metrics-helper
portmap
grpc-health-probe
cni-metrics-helper
Loading

0 comments on commit fbe76f7

Please sign in to comment.