From f2c87e3c3b30b2521ad81dc123291ed44a27ac38 Mon Sep 17 00:00:00 2001 From: Kazuyoshi Kato Date: Thu, 25 Mar 2021 15:37:29 -0700 Subject: [PATCH] Add "lint" target to check Amazon's license header There are multiple files we forgot to add Amazon's license header. This change adds a new Makefile targat that check all files to make sure the header is included. Signed-off-by: Kazuyoshi Kato --- .buildkite/pipeline.yml | 14 +++++++------- .headers/go.txt | 12 ++++++++++++ .headers/makefile.txt | 12 ++++++++++++ Makefile | 17 ++++++++++++++++- 4 files changed, 47 insertions(+), 8 deletions(-) create mode 100644 .headers/go.txt create mode 100644 .headers/makefile.txt diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index 09f34bba..2730c31f 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -55,13 +55,6 @@ steps: - wait - - label: gofmt -s - command: test -z $(gofmt -s -l .) - # This should run in the same queue, but we don't care whether it runs on - # the same host. - agents: - queue: "${BUILDKITE_AGENT_META_DATA_QUEUE:-default}" - - label: 'git log validation' command: './.buildkite/logcheck.sh' # This should run in the same queue, but we don't care whether it runs on @@ -92,6 +85,13 @@ steps: - wait + - label: lint + command: make lint + agents: + queue: "${BUILDKITE_AGENT_META_DATA_QUEUE:-default}" + distro: "${BUILDKITE_AGENT_META_DATA_DISTRO}" + hostname: "${BUILDKITE_AGENT_META_DATA_HOSTNAME}" + - label: 'build' commands: - 'make' diff --git a/.headers/go.txt b/.headers/go.txt new file mode 100644 index 00000000..660bfbb8 --- /dev/null +++ b/.headers/go.txt @@ -0,0 +1,12 @@ +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"). You may +// not use this file except in compliance with the License. A copy of the +// License is located at +// +// http://aws.amazon.com/apache2.0/ +// +// or in the "license" file accompanying this file. This file is distributed +// on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either +// express or implied. See the License for the specific language governing +// permissions and limitations under the License. diff --git a/.headers/makefile.txt b/.headers/makefile.txt new file mode 100644 index 00000000..791318cb --- /dev/null +++ b/.headers/makefile.txt @@ -0,0 +1,12 @@ +# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"). You may +# not use this file except in compliance with the License. A copy of the +# License is located at +# +# http://aws.amazon.com/apache2.0/ +# +# or in the "license" file accompanying this file. This file is distributed +# on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either +# express or implied. See the License for the specific language governing +# permissions and limitations under the License. diff --git a/Makefile b/Makefile index a142a496..2d25ef4e 100644 --- a/Makefile +++ b/Makefile @@ -31,7 +31,14 @@ arch=$(shell uname -m) # The below files are needed and can be downloaded from the internet release_url=https://github.com/firecracker-microvm/firecracker/releases/download/$(firecracker_version)/firecracker-$(firecracker_version)-$(arch).tgz -testdata_objects = $(FC_TEST_DATA_PATH)/vmlinux $(FC_TEST_DATA_PATH)/root-drive.img $(FC_TEST_DATA_PATH)/jailer $(FC_TEST_DATA_PATH)/firecracker + +testdata_objects = \ +$(FC_TEST_DATA_PATH)/vmlinux \ +$(FC_TEST_DATA_PATH)/root-drive.img \ +$(FC_TEST_DATA_PATH)/jailer \ +$(FC_TEST_DATA_PATH)/firecracker \ +$(FC_TEST_DATA_PATH)/ltag + testdata_dir = testdata/firecracker.tgz testdata/firecracker_spec-$(firecracker_version).yaml testdata/LICENSE testdata/NOTICE testdata/THIRD-PARTY # --location is needed to follow redirects on github.com @@ -78,6 +85,10 @@ $(FC_TEST_DATA_PATH)/fc.stamp: $(FC_TEST_DATA_PATH)/root-drive.img: $(curl) -o $@ https://s3.amazonaws.com/spec.ccfc.min/img/hello/fsfiles/hello-rootfs.ext4 +$(FC_TEST_DATA_PATH)/ltag: + GO111MODULE=off GOBIN=$(abspath $(FC_TEST_DATA_PATH)) \ + go get github.com/kunalkushwaha/ltag + tools/firecracker-builder-stamp: tools/docker/Dockerfile docker build \ -t localhost/$(FIRECRACKER_BUILDER_NAME):$(DOCKER_IMAGE_TAG) \ @@ -112,4 +123,8 @@ firecracker-clean: cargo clean - rm $(FIRECRACKER_BIN) $(JAILER_BIN) +lint: deps + gofmt -s -l . + $(FC_TEST_DATA_PATH)/ltag -check -v -t .headers + .PHONY: all generate clean distclean build test unit-tests all-tests check-kvm