Skip to content

Commit e9440a9

Browse files
committed
Add copyright headers.
CI: Improve change detection in install_charts.sh script. Signed-off-by: Dinko Korunic <[email protected]>
1 parent e5e9ba8 commit e9440a9

16 files changed

+274
-20
lines changed

.circleci/install_charts.sh

Lines changed: 49 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -57,22 +57,58 @@ install_charts() {
5757
}
5858

5959
main() {
60-
create_ct_container
61-
trap cleanup EXIT
62-
63-
echo "Testing for chart repo changes"
64-
local changed
65-
changed=$(docker_exec ct list-changed | grep -v "is not a valid chart directory" | grep -c '^[a-zA-Z0-9]' || true)
66-
if [[ ${changed} -eq 0 ]]; then
67-
echo "No chart changes detected"
68-
return
60+
pushd "${REPO_ROOT}" >/dev/null
61+
62+
echo "Fetching tags"
63+
git fetch --tags
64+
65+
local latest_tag
66+
latest_tag=$(find_latest_tag)
67+
68+
local latest_tag_rev
69+
latest_tag_rev=$(git rev-parse --verify "${latest_tag}")
70+
echo "${latest_tag_rev} ${latest_tag} (latest tag)"
71+
72+
local head_rev
73+
head_rev=$(git rev-parse --verify HEAD)
74+
echo "${head_rev} HEAD"
75+
76+
if [[ "${latest_tag_rev}" == "${head_rev}" ]]; then
77+
echo "No code changes. Nothing to release."
78+
exit
79+
fi
80+
81+
mkdir -p "${PACKAGE_PATH}"
82+
83+
echo "Identifying changed charts since tag ${latest_tag}"
84+
85+
local changed_charts=()
86+
readarray -t changed_charts <<< "$(git diff --find-renames --name-only "${latest_tag_rev}" | grep '\.yaml$' | cut -d '/' -f 1 | sort -u)"
87+
88+
if [[ -n "${changed_charts[*]}" ]]; then
89+
local changes_pending=no
90+
for chart in "${changed_charts[@]}"; do
91+
if [[ -f "${chart}/Chart.yaml" ]]; then
92+
changes_pending=yes
93+
break
94+
fi
95+
done
96+
97+
if [[ "${changes_pending}" == "yes" ]]; then
98+
create_ct_container
99+
trap cleanup EXIT
100+
101+
create_kind_cluster
102+
install_local_path_provisioner
103+
install_charts
104+
else
105+
echo "Nothing to do. No chart changes detected."
106+
fi
69107
else
70-
echo "Detected changes in charts: ${changed}"
108+
echo "Nothing to do. No chart changes detected."
71109
fi
72110

73-
create_kind_cluster
74-
install_local_path_provisioner
75-
install_charts
111+
popd >/dev/null
76112
}
77113

78114
main

.circleci/release.sh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ update_index() {
3838
git config user.name "${GIT_USERNAME}"
3939
git checkout gh-pages
4040

41-
#rm -f index.yaml
4241
cr index -i index.yaml -o "${OWNER}" -r "${GIT_REPO}" -c "${CHARTS_URL}" -p "${PACKAGE_PATH}"
4342

4443
git add index.yaml
@@ -68,7 +67,6 @@ main() {
6867
exit
6968
fi
7069

71-
#rm -rf "${PACKAGE_PATH}"
7270
mkdir -p "${PACKAGE_PATH}"
7371

7472
echo "Identifying changed charts since tag ${latest_tag}"

kubernetes-ingress/Chart.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
# Copyright 2019 HAProxy Technologies LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
115
apiVersion: v1
216
name: kubernetes-ingress
317
version: 0.4.0

kubernetes-ingress/templates/_helpers.tpl

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,19 @@
1-
{{/* vim: set filetype=mustache: */}}
21
{{/*
3-
Expand the name of the chart.
2+
Copyright 2019 HAProxy Technologies LLC
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
415
*/}}
16+
517
{{- define "kubernetes-ingress.name" -}}
618
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
719
{{- end -}}
@@ -72,4 +84,9 @@ Create a default fully qualified default cert secret name.
7284
*/}}
7385
{{- define "kubernetes-ingress.defaultTLSSecret.fullname" -}}
7486
{{- printf "%s-%s" (include "kubernetes-ingress.fullname" .) "default-cert" | trunc 63 | trimSuffix "-" -}}
75-
{{- end -}}
87+
{{- end -}}
88+
89+
{{/* vim: set filetype=mustache: */}}
90+
{{/*
91+
Expand the name of the chart.
92+
*/}}

kubernetes-ingress/templates/clusterrole.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
{{/*
2+
Copyright 2019 HAProxy Technologies LLC
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/}}
16+
117
{{- if and .Values.rbac.create -}}
218
apiVersion: rbac.authorization.k8s.io/v1beta1
319
kind: ClusterRole

kubernetes-ingress/templates/clusterrolebinding.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
{{/*
2+
Copyright 2019 HAProxy Technologies LLC
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/}}
16+
117
{{- if and .Values.rbac.create -}}
218
apiVersion: rbac.authorization.k8s.io/v1beta1
319
kind: ClusterRoleBinding

kubernetes-ingress/templates/controller-configmap.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
{{/*
2+
Copyright 2019 HAProxy Technologies LLC
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/}}
16+
117
apiVersion: v1
218
kind: ConfigMap
319
metadata:

kubernetes-ingress/templates/controller-daemonset.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
{{/*
2+
Copyright 2019 HAProxy Technologies LLC
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/}}
16+
117
{{- if eq .Values.controller.kind "DaemonSet" }}
218
{{- $hostPorts := .Values.controller.daemonset.hostPorts -}}
319
apiVersion: apps/v1

kubernetes-ingress/templates/controller-defaultcertsecret.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
{{/*
2+
Copyright 2019 HAProxy Technologies LLC
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/}}
16+
117
apiVersion: v1
218
kind: Secret
319
type: kubernetes.io/tls

kubernetes-ingress/templates/controller-deployment.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
{{/*
2+
Copyright 2019 HAProxy Technologies LLC
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/}}
16+
117
{{- if eq .Values.controller.kind "Deployment" }}
218
apiVersion: apps/v1
319
kind: Deployment

0 commit comments

Comments
 (0)