Skip to content

Commit

Permalink
Merge pull request Mirantis#55 from Mirantis/buildupdates
Browse files Browse the repository at this point in the history
Don't hardcode the build architecture
  • Loading branch information
evol262 authored May 25, 2022
2 parents cdbe2a1 + f00eefe commit 5d7c9ba
Show file tree
Hide file tree
Showing 14 changed files with 169 additions and 41 deletions.
18 changes: 14 additions & 4 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ jobs:
go-version: 1.18
id: go

- name: Setup environment
shell: bash
run: |
echo "GOPATH=${{ github.workspace }}" >> $GITHUB_ENV
echo "${{ github.workspace }}/bin" >> $GITHUB_PATH
- name: Install docker
shell: bash
run: |
Expand Down Expand Up @@ -52,6 +58,11 @@ jobs:
# Restart docker daemon.
sudo service docker restart
- name: Install ginkgo
run: |
go install github.com/onsi/ginkgo/v2/ginkgo@latest
ginkgo version
sudo cp $(command -v ginkgo) /usr/local/bin
- name: Check out cri-tools
uses: actions/checkout@v2
Expand All @@ -62,8 +73,7 @@ jobs:
- name: Build cri-tools
working-directory: src/sigs.k8s.io/cri-tools
run: |
make install.ginkgo critest crictl
sudo mv $(pwd)/build/bin/ginkgo /usr/local/bin
make critest crictl
sudo mv $(pwd)/build/bin/critest /usr/local/bin
sudo mv $(pwd)/build/bin/crictl /usr/local/bin
Expand Down Expand Up @@ -103,7 +113,7 @@ jobs:
# Skip runtime should support execSync with timeout because docker doesn't
# support it.
# Skip apparmor test as we don't enable apparmor yet in this CI job, or selinux
sudo /usr/local/bin/critest -runtime-endpoint=/var/run/cri-dockerd.sock -ginkgo.skip="runtime should support apparmor|runtime should support reopening container log|runtime should support execSync with timeout|runtime should support selinux"
sudo /usr/local/bin/critest -runtime-endpoint=unix:///var/run/cri-dockerd.sock -ginkgo.skip="runtime should support apparmor|runtime should support reopening container log|runtime should support execSync with timeout|runtime should support selinux"
- name: Run benchmark
working-directory: src/sigs.k8s.io/cri-tools
Expand All @@ -117,7 +127,7 @@ jobs:
export LC_ALL=C
# Run benchmark test cases
sudo /usr/local/bin/critest -runtime-endpoint=/var/run/cri-dockerd.sock -benchmark
sudo /usr/local/bin/critest -runtime-endpoint=unix:///var/run/cri-dockerd.sock -benchmark
- name: Dump docker logs
if: always()
Expand Down
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ cross-mac: ## build static packages
cross-win: ## build static packages
$(MAKE) APP_DIR=$(APP_DIR) -C $(PACKAGING_DIR) cross-win

.PHONY: cross-arm
cross-arm: ## build static packages
$(MAKE) APP_DIR=$(APP_DIR) -C $(PACKAGING_DIR) cross-arm

.PHONY: clean
clean: ## clean the build artifacts
-$(MAKE) -C $(PACKAGING_DIR) clean
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,13 @@ and on the Mirantis
To build this code (in a POSIX environment):
```shell
mkdir bin
cd src && go get && go build -o ../bin/cri-dockerd
VERSION=$((git describe --abbrev=0 --tags | sed -e 's/v//') || echo $(cat VERSION)-$(git log -1 --pretty='%h')) PRERELEASE=$(grep -q dev <<< "${VERSION}" && echo "pre" || echo "") REVISION=$(git log -1 --pretty='%h')
export CRI_DOCKERD_LDFLAGS=-ldflags "-X github.com/Mirantis/cri-dockerd/version.Version=${VERSION} -X github.com/Mirantis/cri-dockerd/version.PreRelease=${PRERELEASE} -X github.com/Mirantis/cri-dockerd/version.BuildTime=${BUILD_DATE} -X github.com/Mirantis/cri-dockerd/version.GitCommit=${REVISION}"
go get && go build ${CRI_DOCKERD_LDFLAGS} -o ../bin/cri-dockerd
```

To build for a specific architecture, add `ARCH=` as an argument, where `ARCH` is a known build target for golang

To install, on a Linux system that uses systemd, and already has Docker Engine installed
```shell
# Run these commands as root
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.2.0-dev
0.2.1-dev
2 changes: 1 addition & 1 deletion cmd/version/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package version

var (
// Version of the product
Version = "0.2.0"
Version = "0.2.1"
// PreRelease is set during the build
PreRelease = ""
// GitCommit is set during the build
Expand Down
1 change: 0 additions & 1 deletion core/container_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,3 @@ func (ds *dockerService) ListContainers(

return &v1.ListContainersResponse{Containers: result}, nil
}

4 changes: 3 additions & 1 deletion core/stats.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ func (ds *dockerService) ListContainerStats(

listResp, err := ds.ListContainers(ctx, &runtimeapi.ListContainersRequest{Filter: filter})
if err != nil {
logrus.Errorf("Error listing containers with filter: %+v", filter)
logrus.Errorf("Error listing containers error: ", err)
return nil, err
}

Expand All @@ -67,7 +69,7 @@ func (ds *dockerService) ListContainerStats(
stats = append(stats, containerStats)
mtx.Unlock()
} else if err != nil {
logrus.Error(err, "Failed to get stats from container "+container.Id)
logrus.Error(err, " Failed to get stats from container "+container.Id)
}
}()
}
Expand Down
1 change: 1 addition & 0 deletions core/stats_linux.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build linux
// +build linux

/*
Expand Down
88 changes: 82 additions & 6 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/Mirantis/cri-dockerd

go 1.14
go 1.18

require (
github.com/Microsoft/hcsshim v0.8.10-0.20200715222032-5eafd1556990
Expand All @@ -14,9 +14,6 @@ require (
github.com/docker/go-connections v0.4.0
github.com/emicklei/go-restful v2.9.5+incompatible
github.com/golang/mock v1.6.0
github.com/imdario/mergo v0.3.7 // indirect
github.com/onsi/ginkgo v1.12.0 // indirect
github.com/onsi/gomega v1.8.1 // indirect
github.com/opencontainers/go-digest v1.0.0
github.com/opencontainers/image-spec v1.0.1
github.com/opencontainers/runc v1.0.0-rc92
Expand All @@ -26,8 +23,7 @@ require (
github.com/spf13/pflag v1.0.5
github.com/stretchr/testify v1.6.1
github.com/vishvananda/netlink v1.1.0
golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d // indirect
golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e
golang.org/x/sys v0.0.0-20220319134239-a9b59b0215f8
google.golang.org/grpc v1.27.1
k8s.io/api v0.20.4
k8s.io/apimachinery v0.20.4
Expand All @@ -39,6 +35,86 @@ require (
k8s.io/utils v0.0.0-20201110183641-67b214c5f920
)

require (
github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78 // indirect
github.com/JeffAshton/win_pdh v0.0.0-20161109143554-76bb4ee9f0ab // indirect
github.com/Microsoft/go-winio v0.4.15 // indirect
github.com/NYTimes/gziphandler v0.0.0-20170623195520-56545f4a5d46 // indirect
github.com/PuerkitoBio/purell v1.1.1 // indirect
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.1.1 // indirect
github.com/containerd/cgroups v0.0.0-20200531161412-0dbf7f05ba59 // indirect
github.com/containerd/containerd v1.4.1 // indirect
github.com/coreos/go-semver v0.3.0 // indirect
github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e // indirect
github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f // indirect
github.com/cyphar/filepath-securejoin v0.2.2 // indirect
github.com/docker/go-units v0.4.0 // indirect
github.com/docker/spdystream v0.0.0-20160310174837-449fdfce4d96 // indirect
github.com/evanphx/json-patch v4.9.0+incompatible // indirect
github.com/go-logr/logr v0.2.0 // indirect
github.com/go-openapi/jsonpointer v0.19.3 // indirect
github.com/go-openapi/jsonreference v0.19.3 // indirect
github.com/go-openapi/spec v0.19.3 // indirect
github.com/go-openapi/swag v0.19.5 // indirect
github.com/godbus/dbus/v5 v5.0.3 // indirect
github.com/gogo/protobuf v1.3.1 // indirect
github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/google/cadvisor v0.38.7 // indirect
github.com/google/go-cmp v0.5.5 // indirect
github.com/google/gofuzz v1.1.0 // indirect
github.com/google/uuid v1.1.2 // indirect
github.com/googleapis/gnostic v0.4.1 // indirect
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 // indirect
github.com/hashicorp/golang-lru v0.5.1 // indirect
github.com/imdario/mergo v0.3.7 // indirect
github.com/inconshreveable/mousetrap v1.0.0 // indirect
github.com/json-iterator/go v1.1.10 // indirect
github.com/lithammer/dedent v1.1.0 // indirect
github.com/mailru/easyjson v0.7.0 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect
github.com/moby/sys/mountinfo v0.1.3 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.1 // indirect
github.com/morikuni/aec v1.0.0 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/onsi/gomega v1.19.0 // indirect
github.com/opencontainers/runtime-spec v1.0.3-0.20200728170252-4d89ac9fbff6 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/prometheus/client_golang v1.7.1 // indirect
github.com/prometheus/client_model v0.2.0 // indirect
github.com/prometheus/common v0.10.0 // indirect
github.com/prometheus/procfs v0.2.0 // indirect
github.com/stretchr/objx v0.2.0 // indirect
github.com/vishvananda/netns v0.0.0-20200728191858-db3c7e526aae // indirect
go.etcd.io/etcd v0.5.0-alpha.5.0.20200910180754-dd1b699fc489 // indirect
go.opencensus.io v0.22.3 // indirect
go.uber.org/atomic v1.4.0 // indirect
go.uber.org/multierr v1.1.0 // indirect
go.uber.org/zap v1.10.0 // indirect
golang.org/x/crypto v0.0.0-20201002170205-7f63de1d35b0 // indirect
golang.org/x/net v0.0.0-20220225172249-27dd8689420f // indirect
golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d // indirect
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c // indirect
golang.org/x/text v0.3.7 // indirect
golang.org/x/time v0.0.0-20200630173020-3af7569d3a1e // indirect
google.golang.org/appengine v1.6.5 // indirect
google.golang.org/genproto v0.0.0-20201110150050-8816d57aaa9a // indirect
google.golang.org/protobuf v1.26.0 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect
k8s.io/cloud-provider v0.20.4 // indirect
k8s.io/klog/v2 v2.4.0 // indirect
k8s.io/kube-openapi v0.0.0-20201113171705-d219536bb9fd // indirect
k8s.io/mount-utils v0.0.0 // indirect
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.0.14 // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.0.2 // indirect
sigs.k8s.io/yaml v1.2.0 // indirect
)

replace (
k8s.io/api => k8s.io/api v0.20.4
k8s.io/apiextensions-apiserver => k8s.io/apiextensions-apiserver v0.20.4
Expand Down
Loading

0 comments on commit 5d7c9ba

Please sign in to comment.