Skip to content

Commit

Permalink
Fix buildimg image in docker container
Browse files Browse the repository at this point in the history
  • Loading branch information
gnufied committed Sep 4, 2020
1 parent 85a1429 commit 121d613
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 50 deletions.
1 change: 0 additions & 1 deletion .dockerignore

This file was deleted.

8 changes: 1 addition & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,7 @@

FROM golang:1.14.1-stretch as builder
WORKDIR /go/src/github.com/kubernetes-sigs/aws-ebs-csi-driver

# Cache go modules
COPY go.mod .
COPY go.sum .
RUN go mod download

ADD . .
COPY . .
RUN make

FROM amazonlinux:2
Expand Down
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,10 @@ push-release:
push:
docker push $(IMAGE):latest

.PHONY: test-vendor
test: test-vendor
verify: test-vendor
test-vendor:
.PHONY: verify-vendor
test: verify-vendor
verify: verify-vendor
verify-vendor:
@ echo; echo "### $@:"
@ ./hack/verify-vendor.sh

Expand Down
1 change: 1 addition & 0 deletions hack/verify-all
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@ PKG_ROOT=$(git rev-parse --show-toplevel)
${PKG_ROOT}/hack/verify-gofmt
${PKG_ROOT}/hack/verify-govet
${PKG_ROOT}/hack/verify-golint
${PKG_ROOT}/hack/verify-vendor.sh
56 changes: 18 additions & 38 deletions hack/verify-vendor.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,47 +14,27 @@
# See the License for the specific language governing permissions and
# limitations under the License.

if [ -f Gopkg.toml ]; then
echo "Repo uses 'dep' for vendoring."
case "$(dep version 2>/dev/null | grep 'version *:')" in
*v0.[56789]*)
if dep check; then
echo "vendor up-to-date"
else
exit 1
fi
;;
*) echo "skipping check, dep >= 0.5 required";;
esac
elif [ -f go.mod ]; then
echo "Repo uses 'go mod'."
# shellcheck disable=SC2235
if [ "${JOB_NAME}" ] &&
( [ "${JOB_TYPE}" != "presubmit" ] ||
[ "$( (git diff "${PULL_BASE_SHA}..HEAD" -- go.mod go.sum vendor release-tools;
git diff "${PULL_BASE_SHA}..HEAD" | grep -e '^@@.*@@ import (' -e '^[+-]import') |
wc -l)" -eq 0 ] ); then
echo "Skipping vendor check because the Prow pre-submit job does not affect dependencies."
elif ! (set -x; env GO111MODULE=on go mod tidy); then

echo "Repo uses 'go mod'."
if ! (set -x; env GO111MODULE=on go mod tidy); then
echo "ERROR: vendor check failed."
exit 1
elif [ "$(git status --porcelain -- go.mod go.sum | wc -l)" -gt 0 ]; then
echo "ERROR: go module files *not* up-to-date, they did get modified by 'GO111MODULE=on go mod tidy':";
git diff -- go.mod go.sum
exit 1
elif [ -d vendor ]; then
if ! (set -x; env GO111MODULE=on go mod vendor); then
echo "ERROR: vendor check failed."
exit 1
elif [ "$(git status --porcelain -- go.mod go.sum | wc -l)" -gt 0 ]; then
echo "ERROR: go module files *not* up-to-date, they did get modified by 'GO111MODULE=on go mod tidy':";
git diff -- go.mod go.sum
elif [ "$(git status --porcelain -- vendor | wc -l)" -gt 0 ]; then
echo "ERROR: vendor directory *not* up-to-date, it did get modified by 'GO111MODULE=on go mod vendor':"
git status -- vendor
git diff -- vendor
exit 1
elif [ -d vendor ]; then
if ! (set -x; env GO111MODULE=on go mod vendor); then
echo "ERROR: vendor check failed."
exit 1
elif [ "$(git status --porcelain -- vendor | wc -l)" -gt 0 ]; then
echo "ERROR: vendor directory *not* up-to-date, it did get modified by 'GO111MODULE=on go mod vendor':"
git status -- vendor
git diff -- vendor
exit 1
else
echo "Go dependencies and vendor directory up-to-date."
fi
else
echo "Go dependencies up-to-date."
echo "Go dependencies and vendor directory up-to-date."
fi
else
echo "Go dependencies up-to-date."
fi

0 comments on commit 121d613

Please sign in to comment.