Skip to content

Commit

Permalink
Merge pull request #34 from v1v/feature/support-opt-out-scm-email
Browse files Browse the repository at this point in the history
feat: opt-out scm.email
  • Loading branch information
olblak authored Sep 13, 2024
2 parents bbab87a + 6e4f2e8 commit e68daf2
Show file tree
Hide file tree
Showing 94 changed files with 239 additions and 44 deletions.
29 changes: 20 additions & 9 deletions .ci/scripts/release.bash
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@ function runUpdatecliDiff(){
updatecli diff \
--config "$POLICY_ROOT_DIR/updatecli.d" \
--values "$POLICY_ROOT_DIR/values.yaml" \
--values "$POLICY_ROOT_DIR/testdata/values.yaml" \
--experimental
--values "$POLICY_ROOT_DIR/testdata/values.yaml"
}

function validateRequiredFile(){
Expand Down Expand Up @@ -119,6 +118,16 @@ function validateRequiredFile(){
POLICY_ERROR=true
echo " * Changelog missing a version entry such as '## $versionInformation' in $POLICY_CHANGELOG"
fi

# Testing that the latest changelog version is used in the Policy.yaml
latestVersionChangelogEntry=$( grep -r '## ' -m 1 "$POLICY_CHANGELOG")
latestVersionChangelogEntry=${latestVersionChangelogEntry#"## "}
if [[ "$latestVersionChangelogEntry" != "$versionInformation" ]]; then
POLICY_ERROR=true
echo " * Latest Changelog version isn't the one used in Policy.yaml"
echo " '## $latestVersionChangelogEntry' in $POLICY_CHANGELOG"
echo " '## $versionInformation' in $POLICY_METADATA"
fi
}

function main(){
Expand All @@ -134,20 +143,21 @@ function main(){
POLICY_ROOT_DIR=$(dirname "$POLICY")
POLICY_ERROR=false

if [[ "$PARAM" == "--e2e-test" ]]; then
runUpdatecliDiff "$POLICY_ROOT_DIR"
fi

if [[ "$PARAM" == "--unit-test" || "$PARAM" == "" ]]; then
validateRequiredFile "$POLICY_ROOT_DIR"
fi

if [[ "$POLICY_ERROR" = "false" ]]; then
echo " => all is good"

if [[ "$PARAM" == "--publish" ]]; then
release "$POLICY_ROOT_DIR"
fi

if [[ "$PARAM" == "--e2e-test" ]]; then
runUpdatecliDiff "$POLICY_ROOT_DIR"
fi

if [[ "$PARAM" == "--unit-test" || "$PARAM" == "" ]]; then
validateRequiredFile "$POLICY_ROOT_DIR"
fi
else
echo ""
echo " => validation test not passing"
Expand All @@ -161,3 +171,4 @@ function main(){
}

main "${1:-}"

4 changes: 4 additions & 0 deletions updatecli/policies/autodiscovery/all/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 0.7.0

* Allow to opt out `scm.email`.

## 0.6.0

* Allow to set commit with GitHub GraphQL API using `scm.commitusingapi`
Expand Down
2 changes: 1 addition & 1 deletion updatecli/policies/autodiscovery/all/Policy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ authors:
url: "https://github.com/updatecli/policies/"
documentation: "https://github.com/updatecli/policies/tree/main/updatecli/policies/autodiscovery/all/README.md"
source: "https://github.com/updatecli/policies/tree/main/updatecli/policies/autodiscovery/all/"
version: 0.6.0
version: 0.7.0
vendor: Updatecli Project

licenses:
Expand Down
2 changes: 2 additions & 0 deletions updatecli/policies/autodiscovery/all/updatecli.d/default.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ scms:
# {{ $GitHubUser := env ""}}
# Priority set to the environment variable
user: '{{ default $GitHubUser .scm.user }}'
# {{ if .scm.email }}
email: '{{ .scm.email }}'
# {{ end }}
# {{ $GitHubRepositoryList := env "GITHUB_REPOSITORY" | split "/"}}
owner: '{{ default $GitHubRepositoryList._0 .scm.owner }}'
repository: '{{ default $GitHubRepositoryList._1 .scm.repository }}'
Expand Down
4 changes: 4 additions & 0 deletions updatecli/policies/autodiscovery/cargo/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 0.5.0

* Allow to opt out `scm.email`.

## 0.4.0

* Allow to set commit with GitHub GraphQL API using `scm.commitusingapi`
Expand Down
2 changes: 1 addition & 1 deletion updatecli/policies/autodiscovery/cargo/Policy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ authors:
url: "https://github.com/updatecli/policies/"
documentation: "https://github.com/updatecli/policies/tree/main/updatecli/policies/autodiscovery/cargo/README.md"
source: "https://github.com/updatecli/policies/tree/main/updatecli/policies/autodiscovery/cargo/"
version: 0.4.0
version: 0.5.0
vendor: Updatecli Project

licenses:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ scms:
spec:
# Priority set to the environment variable
user: '{{ default $GitHubUser .scm.user }}'
# {{ if .scm.email }}
email: '{{ .scm.email }}'
# {{ end }}
owner: '{{ default $GitHubRepositoryList._0 .scm.owner }}'
repository: '{{ default $GitHubRepositoryList._1 .scm.repository }}'
token: '{{ default $GitHubPAT .scm.token }}'
Expand Down
4 changes: 4 additions & 0 deletions updatecli/policies/autodiscovery/dockercompose/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 0.5.0

* Allow to opt out `scm.email`.

## 0.4.0

* Allow to set commit with GitHub GraphQL API using `scm.commitusingapi`
Expand Down
2 changes: 1 addition & 1 deletion updatecli/policies/autodiscovery/dockercompose/Policy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ authors:
url: "https://github.com/updatecli/policies/"
documentation: "https://github.com/updatecli/policies/tree/main/updatecli/policies/autodiscovery/dockercompose/README.md"
source: "https://github.com/updatecli/policies/tree/main/updatecli/policies/autodiscovery/dockercompose/"
version: 0.4.0
version: 0.5.0
vendor: Updatecli Project

licenses:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ scms:
spec:
# Priority set to the environment variable
user: '{{ default $GitHubUser .scm.user }}'
# {{ if .scm.email }}
email: '{{ .scm.email }}'
# {{ end }}
owner: '{{ default $GitHubRepositoryList._0 .scm.owner }}'
repository: '{{ default $GitHubRepositoryList._1 .scm.repository }}'
token: '{{ default $GitHubPAT .scm.token }}'
Expand Down
4 changes: 4 additions & 0 deletions updatecli/policies/autodiscovery/dockerfile/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 0.5.0

* Allow to opt out `scm.email`.

## 0.4.0

* Allow to set commit with GitHub GraphQL API using `scm.commitusingapi`
Expand Down
2 changes: 1 addition & 1 deletion updatecli/policies/autodiscovery/dockerfile/Policy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ authors:
url: "https://github.com/updatecli/policies/"
documentation: "https://github.com/updatecli/policies/tree/main/updatecli/policies/autodiscovery/dockerfile/README.md"
source: "https://github.com/updatecli/policies/tree/main/updatecli/policies/autodiscovery/dockerfile/"
version: 0.4.0
version: 0.5.0
vendor: Updatecli Project

licenses:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ scms:
spec:
# Priority set to the environment variable
user: '{{ default $GitHubUser .scm.user }}'
# {{ if .scm.email }}
email: '{{ .scm.email }}'
# {{ end }}
owner: '{{ default $GitHubRepositoryList._0 .scm.owner }}'
repository: '{{ default $GitHubRepositoryList._1 .scm.repository }}'
token: '{{ default $GitHubPAT .scm.token }}'
Expand Down
4 changes: 4 additions & 0 deletions updatecli/policies/autodiscovery/flux/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 0.5.0

* Allow to opt out `scm.email`.

## 0.4.0

* Allow to set commit with GitHub GraphQL API using `scm.commitusingapi`
Expand Down
2 changes: 1 addition & 1 deletion updatecli/policies/autodiscovery/flux/Policy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ authors:
url: "https://github.com/updatecli/policies/"
documentation: "https://github.com/updatecli/policies/tree/main/updatecli/policies/autodiscovery/flux/README.md"
source: "https://github.com/updatecli/policies/tree/main/updatecli/policies/autodiscovery/flux/"
version: 0.4.0
version: 0.5.0
vendor: Updatecli Project

licenses:
Expand Down
2 changes: 2 additions & 0 deletions updatecli/policies/autodiscovery/flux/updatecli.d/default.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ scms:
spec:
# Priority set to the environment variable
user: '{{ default $GitHubUser .scm.user }}'
# {{ if .scm.email }}
email: '{{ .scm.email }}'
# {{ end }}
owner: '{{ default $GitHubRepositoryList._0 .scm.owner }}'
repository: '{{ default $GitHubRepositoryList._1 .scm.repository }}'
token: '{{ default $GitHubPAT .scm.token }}'
Expand Down
4 changes: 4 additions & 0 deletions updatecli/policies/autodiscovery/golang/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 0.9.0

* Allow to opt out `scm.email`.

## 0.8.0

* Allow to set commit with GitHub GraphQL API using `scm.commitusingapi`
Expand Down
2 changes: 1 addition & 1 deletion updatecli/policies/autodiscovery/golang/Policy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ authors:
url: "https://github.com/updatecli/policies/"
documentation: "https://github.com/updatecli/policies/tree/main/updatecli/policies/autodiscovery/golang/README.md"
source: "https://github.com/updatecli/policies/tree/main/updatecli/policies/autodiscovery/golang/"
version: 0.8.0
version: 0.9.0
vendor: Updatecli Project

licenses:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ scms:
spec:
# Priority set to the environment variable
user: '{{ default $GitHubUser .scm.user}}'
# {{ if .scm.email }}
email: '{{ .scm.email }}'
# {{ end }}
owner: '{{ default $GitHubRepositoryList._0 .scm.owner }}'
repository: '{{ default $GitHubRepositoryList._1 .scm.repository}}'
token: '{{ default $GitHubPAT .scm.token }}'
Expand Down
4 changes: 4 additions & 0 deletions updatecli/policies/autodiscovery/helm/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 0.5.0

* Allow to opt out `scm.email`.

## 0.4.0

* Allow to set commit with GitHub GraphQL API using `scm.commitusingapi`
Expand Down
2 changes: 1 addition & 1 deletion updatecli/policies/autodiscovery/helm/Policy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ authors:
url: "https://github.com/updatecli/policies/"
documentation: "https://github.com/updatecli/policies/tree/main/updatecli/policies/autodiscovery/helm/README.md"
source: "https://github.com/updatecli/policies/tree/main/updatecli/policies/autodiscovery/helm/"
version: 0.4.0
version: 0.5.0
vendor: Updatecli Project

licenses:
Expand Down
2 changes: 2 additions & 0 deletions updatecli/policies/autodiscovery/helm/updatecli.d/default.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ scms:
spec:
# Priority set to the environment variable
user: '{{ default $GitHubUser .scm.user }}'
# {{ if .scm.email }}
email: '{{ .scm.email }}'
# {{ end }}
owner: '{{ default $GitHubRepositoryList._0 .scm.owner }}'
repository: '{{ default $GitHubRepositoryList._1 .scm.repository }}'
token: '{{ default $GitHubPAT .scm.token }}'
Expand Down
4 changes: 4 additions & 0 deletions updatecli/policies/autodiscovery/helmfile/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 0.5.0

* Allow to opt out `scm.email`.

## 0.4.0

* Allow to set commit with GitHub GraphQL API using `scm.commitusingapi`
Expand Down
2 changes: 1 addition & 1 deletion updatecli/policies/autodiscovery/helmfile/Policy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ authors:
url: "https://github.com/updatecli/policies/"
documentation: "https://github.com/updatecli/policies/tree/main/updatecli/policies/autodiscovery/helmfile/README.md"
source: "https://github.com/updatecli/policies/tree/main/updatecli/policies/autodiscovery/helmfile/"
version: 0.4.0
version: 0.5.0
vendor: Updatecli Project

licenses:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ scms:
spec:
# Priority set to the environment variable
user: '{{ default $GitHubUser .scm.user }}'
# {{ if .scm.email }}
email: '{{ .scm.email }}'
# {{ end }}
owner: '{{ default $GitHubRepositoryList._0 .scm.owner }}'
repository: '{{ default $GitHubRepositoryList._1 .scm.repository }}'
token: '{{ default $GitHubPAT .scm.token }}'
Expand Down
4 changes: 4 additions & 0 deletions updatecli/policies/autodiscovery/ko/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 0.5.0

* Allow to opt out `scm.email`.

## 0.4.0

* Allow to set commit with GitHub GraphQL API using `scm.commitusingapi`
Expand Down
2 changes: 1 addition & 1 deletion updatecli/policies/autodiscovery/ko/Policy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ authors:
url: "https://github.com/updatecli/policies/"
documentation: "https://github.com/updatecli/policies/tree/main/updatecli/policies/autodiscovery/ko/README.md"
source: "https://github.com/updatecli/policies/tree/main/updatecli/policies/autodiscovery/ko/"
version: 0.4.0
version: 0.5.0
vendor: Updatecli Project

licenses:
Expand Down
2 changes: 2 additions & 0 deletions updatecli/policies/autodiscovery/ko/updatecli.d/default.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ scms:
spec:
# Priority set to the environment variable
user: '{{ default $GitHubUser .scm.user }}'
# {{ if .scm.email }}
email: '{{ .scm.email }}'
# {{ end }}
owner: '{{ default $GitHubRepositoryList._0 .scm.owner }}'
repository: '{{ default $GitHubRepositoryList._1 .scm.repository }}'
token: '{{ default $GitHubPAT .scm.token }}'
Expand Down
4 changes: 4 additions & 0 deletions updatecli/policies/autodiscovery/kubernetes/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 0.5.0

* Allow to opt out `scm.email`.

## 0.4.0

* Allow to set commit with GitHub GraphQL API using `scm.commitusingapi`
Expand Down
2 changes: 1 addition & 1 deletion updatecli/policies/autodiscovery/kubernetes/Policy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ authors:
url: "https://github.com/updatecli/policies/"
documentation: "https://github.com/updatecli/policies/tree/main/updatecli/policies/autodiscovery/kubernetes/README.md"
source: "https://github.com/updatecli/policies/tree/main/updatecli/policies/autodiscovery/kubernetes/"
version: 0.4.0
version: 0.5.0
vendor: Updatecli Project

licenses:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ scms:
spec:
# Priority set to the environment variable
user: '{{ default $GitHubUser .scm.user }}'
# {{ if .scm.email }}
email: '{{ .scm.email }}'
# {{ end }}
owner: '{{ default $GitHubRepositoryList._0 .scm.owner }}'
repository: '{{ default $GitHubRepositoryList._1 .scm.repository }}'
token: '{{ default $GitHubPAT .scm.token }}'
Expand Down
4 changes: 4 additions & 0 deletions updatecli/policies/autodiscovery/maven/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 0.5.0

* Allow to opt out `scm.email`.

## 0.4.0

* Allow to set commit with GitHub GraphQL API using `scm.commitusingapi`
Expand Down
2 changes: 1 addition & 1 deletion updatecli/policies/autodiscovery/maven/Policy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ authors:
url: "https://github.com/updatecli/policies/"
documentation: "https://github.com/updatecli/policies/tree/main/updatecli/policies/autodiscovery/maven/README.md"
source: "https://github.com/updatecli/policies/tree/main/updatecli/policies/autodiscovery/maven/"
version: 0.4.0
version: 0.5.0
vendor: Updatecli Project

licenses:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ scms:
spec:
# Priority set to the environment variable
user: '{{ default $GitHubUser .scm.user }}'
# {{ if .scm.email }}
email: '{{ .scm.email }}'
# {{ end }}
owner: '{{ default $GitHubRepositoryList._0 .scm.owner }}'
repository: '{{ default $GitHubRepositoryList._1 .scm.repository }}'
token: '{{ default $GitHubPAT .scm.token }}'
Expand Down
4 changes: 4 additions & 0 deletions updatecli/policies/autodiscovery/npm/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# CHANGELOG

## 0.10.0

* Allow to opt out `scm.email`.

## 0.9.0

* Allow to set commit with GitHub GraphQL API using `scm.commitusingapi`
Expand Down
2 changes: 1 addition & 1 deletion updatecli/policies/autodiscovery/npm/Policy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ authors:
url: "https://github.com/updatecli/policies/"
documentation: "https://github.com/updatecli/policies/tree/main/updatecli/policies/autodiscovery/npm/README.md"
source: "https://github.com/updatecli/policies/tree/main/updatecli/policies/autodiscovery/npm/"
version: 0.9.0
version: 0.10.0
vendor: Updatecli Project

licenses:
Expand Down
Loading

0 comments on commit e68daf2

Please sign in to comment.