Skip to content

Commit

Permalink
Add "lint" target to check Amazon's license header
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
kzys committed Mar 31, 2021
1 parent b453d4a commit f2c87e3
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 8 deletions.
14 changes: 7 additions & 7 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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'
Expand Down
12 changes: 12 additions & 0 deletions .headers/go.txt
Original file line number Diff line number Diff line change
@@ -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.
12 changes: 12 additions & 0 deletions .headers/makefile.txt
Original file line number Diff line number Diff line change
@@ -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.
17 changes: 16 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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) \
Expand Down Expand Up @@ -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

0 comments on commit f2c87e3

Please sign in to comment.