Skip to content

Commit

Permalink
Add license header file and script (#1256)
Browse files Browse the repository at this point in the history
* add license header file

Signed-off-by: Michael Valdron <mvaldron@redhat.com>

* addlicense script

Signed-off-by: Michael Valdron <mvaldron@redhat.com>

* update README with instructions on adding license headers

Signed-off-by: Michael Valdron <mvaldron@redhat.com>

* update license headers under source files

Signed-off-by: Michael Valdron <mvaldron@redhat.com>

* remove license header from generated source

Signed-off-by: Michael Valdron <mvaldron@redhat.com>

* add_license.sh ignores zz_generated.* source files

Signed-off-by: Michael Valdron <mvaldron@redhat.com>

* check license headers script added

Signed-off-by: Michael Valdron <mvaldron@redhat.com>

* check license headers script added to CI workflow

Signed-off-by: Michael Valdron <mvaldron@redhat.com>

---------

Signed-off-by: Michael Valdron <mvaldron@redhat.com>
  • Loading branch information
michael-valdron committed Sep 25, 2023
1 parent f331a0b commit e05a235
Show file tree
Hide file tree
Showing 163 changed files with 2,584 additions and 82 deletions.
16 changes: 16 additions & 0 deletions .codecov.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
#
#
# Copyright Red Hat
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License 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.

# See http://docs.codecov.io/docs/coverage-configuration
coverage:
precision: 2 # 2 = xx.xx%, 0 = xx%
Expand Down
5 changes: 3 additions & 2 deletions .devfile.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# Copyright (c) 2022 Red Hat, Inc.
#
#
# Copyright Red Hat
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -11,7 +13,6 @@
# 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.
#
schemaVersion: 2.1.0
metadata:
name: devfile-api
Expand Down
15 changes: 15 additions & 0 deletions .devfile/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
#
#
# Copyright Red Hat
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License 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.
FROM python:3-alpine
ENV GOROOT /usr/lib/go

Expand Down
15 changes: 15 additions & 0 deletions .devfile/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,19 @@
#!/bin/bash
#
#
# Copyright Red Hat
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License 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.

# Ensure $HOME exists when starting
if [ ! -d "${HOME}" ]; then
Expand Down
16 changes: 16 additions & 0 deletions .github/workflows/che.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
#
#
# Copyright Red Hat
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License 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.

# Add Che link on PRs
name: Che

Expand Down
22 changes: 22 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
#
#
# Copyright Red Hat
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License 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.

name: CI

# Triggers the workflow on push or pull request events but only for the main branch
Expand Down Expand Up @@ -38,6 +54,12 @@ jobs:
- name: Validate samples against schemas
run: bash ./docker-run.sh ./validate-samples.sh

- name: Check license headers
run: |
export PATH=$PATH:$(go env GOPATH)/bin
go install github.com/google/addlicense@latest
bash ./check_licenses.sh
- name: Run GO tests
run: go test -coverprofile cover.out -v ./...

Expand Down
16 changes: 16 additions & 0 deletions .github/workflows/codecov.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
#
#
# Copyright Red Hat
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License 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.

name: Code Coverage Report
on:
push:
Expand Down
16 changes: 16 additions & 0 deletions .github/workflows/publish-devfile-schema.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
#
#
# Copyright Red Hat
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License 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.

name: Publish Devfile Schema

# Triggers the workflow on push events but only for the main branch
Expand Down
16 changes: 16 additions & 0 deletions .github/workflows/release-devfile-schema.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
#
#
# Copyright Red Hat
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License 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.

name: Release Devfile Schema

# Triggers the workflow when a release is published on GitHub.
Expand Down
16 changes: 16 additions & 0 deletions .github/workflows/release-typescript-models.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
#
#
# Copyright Red Hat
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License 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.

# Release a typescript package to npm containing the typescript types generated from the latest merged crds
name: Release Typescript Models

Expand Down
16 changes: 16 additions & 0 deletions .github/workflows/stale.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
#
#
# Copyright Red Hat
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License 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.

name: Mark stale issues and pull requests

on:
Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,9 @@ Please see our [contributing.md](./CONTRIBUTING.md).
## License

Apache License 2.0, see [LICENSE](./LICENSE) for details.

### Adding License Headers

[`license_header`](./license_header.txt) contains the license header to be contained under all source files. For Go sources, this can be included by running `bash add_licenses.sh`.

Ensure `github.com/google/addlicense` is installed by running `go install github.com/google/addlicense@latest`.
29 changes: 29 additions & 0 deletions add_licenses.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/bin/bash
#
#
# Copyright Red Hat
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License 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.

# This script adds license headers that are missing from go files


if ! command -v addlicense 2> /dev/null
then
echo "error addlicense must be installed with this command: go install github.com/google/addlicense@latest" && exit 1
else
echo 'addlicense -v -f license_header.txt **/*.go'
addlicense -v -f license_header.txt $(find . -not -path '*/\.*' -not -path '*/vendor/*' -not -name 'zz_generated.*.go' -name '*.go')
fi


21 changes: 11 additions & 10 deletions build-generator.sh
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
#!/bin/bash
#
# Copyright 2020-2022 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# Copyright Red Hat
#
# http://www.apache.org/licenses/LICENSE-2.0
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License 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.
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License 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.

BLUE='\033[1;34m'
GREEN='\033[0;32m'
Expand Down
21 changes: 11 additions & 10 deletions build.sh
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
#!/bin/bash
#
# Copyright 2020-2022 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# Copyright Red Hat
#
# http://www.apache.org/licenses/LICENSE-2.0
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License 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.
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License 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.

BLUE='\033[1;34m'
GREEN='\033[0;32m'
Expand Down
21 changes: 11 additions & 10 deletions build/typescript-model/generate-metadata.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
#
# Copyright 2021-2022 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# Copyright Red Hat
#
# http://www.apache.org/licenses/LICENSE-2.0
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License 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.
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License 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.

import os
import argparse
Expand Down
21 changes: 11 additions & 10 deletions build/typescript-model/generate-swagger-json.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
#
# Copyright 2021-2022 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# Copyright Red Hat
#
# http://www.apache.org/licenses/LICENSE-2.0
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License 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.
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License 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.

import os
import json
Expand Down
Loading

0 comments on commit e05a235

Please sign in to comment.