Skip to content
This repository has been archived by the owner on Dec 11, 2023. It is now read-only.

Commit

Permalink
Align files (#1349)
Browse files Browse the repository at this point in the history
Co-authored-by: github-actions <action@github.com>
  • Loading branch information
architectbot and actions-user committed Jul 15, 2022
1 parent 0893659 commit eae0a53
Show file tree
Hide file tree
Showing 10 changed files with 173 additions and 33 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
@@ -1,7 +1,7 @@
version: 2.1

orbs:
architect: giantswarm/architect@4.13.0
architect: giantswarm/architect@4.24.0

workflows:
build:
Expand Down
46 changes: 46 additions & 0 deletions .github/workflows/zz_generated.check_values_schema.yaml
@@ -0,0 +1,46 @@
# DO NOT EDIT. Generated with:
#
# devctl@5.8.0
#
name: 'Check if values schema file has been updated'
on: pull_request

jobs:
check:
name: 'Check values.yaml and its schema in PR'
runs-on: ubuntu-latest
steps:
- name: 'Checkout'
uses: actions/checkout@v3
- name: 'Check if values.schema.json was updated'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
VALUES_FILE_CHANGED="false"
SCHEMA_FILE_CHANGED="false"
echo "Comparing ${GITHUB_BASE_REF}...${GITHUB_HEAD_REF}"
changed_files=$(gh api "repos/{owner}/{repo}/compare/${GITHUB_BASE_REF}...${GITHUB_HEAD_REF}" --jq ".files[] | .filename")
if grep -q "values.schema.json" <<< $(git ls-tree -r --name-only ${GITHUB_SHA}); then
if grep -q "values.yaml" <<< "${changed_files}" ; then
VALUES_FILE_CHANGED="true"
fi
if grep -q "values.schema.json" <<< "${changed_files}" ; then
SCHEMA_FILE_CHANGED="true"
fi
if [ $VALUES_FILE_CHANGED != $SCHEMA_FILE_CHANGED ]; then
echo "FAILED: values.yaml was updated but values.schema.json hasn't been regenerated"
echo "Please refer to this document: https://intranet.giantswarm.io/docs/organizational-structure/teams/cabbage/app-updates/helm-values-schema/"
exit 1
fi
echo "PASSED: values.yaml and values.schema.json both appear to have been updated"
exit 0
fi
echo "INFO: values.schema.json not present in this repo - nothing to do"
13 changes: 9 additions & 4 deletions .github/workflows/zz_generated.create_release.yaml
@@ -1,6 +1,6 @@
# DO NOT EDIT. Generated with:
#
# devctl@4.20.1
# devctl@5.8.0
#
name: Create Release
on:
Expand Down Expand Up @@ -120,11 +120,13 @@ jobs:
echo "error: no changes in \"$file\"" >&2
exit 1
fi
- name: Set up git identity
run: |
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
- name: Commit changes
run: |
file="${{ needs.gather_facts.outputs.project_go_path }}"
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add $file
git commit -m "Bump version to ${{ steps.update_project_go.outputs.new_version }}"
- name: Push changes
Expand Down Expand Up @@ -167,10 +169,13 @@ jobs:
with:
version: ${{ needs.gather_facts.outputs.version }}
path: ./CHANGELOG.md
- name: Set up git identity
run: |
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
- name: Create tag
run: |
version="${{ needs.gather_facts.outputs.version }}"
git config --local user.name "github-actions"
git tag "v$version" ${{ github.sha }}
- name: Push tag
env:
Expand Down
69 changes: 65 additions & 4 deletions .github/workflows/zz_generated.create_release_pr.yaml
@@ -1,6 +1,6 @@
# DO NOT EDIT. Generated with:
#
# devctl@4.20.1
# devctl@5.8.0
#
name: Create Release PR
on:
Expand Down Expand Up @@ -44,6 +44,7 @@ jobs:
repo_name: ${{ steps.gather_facts.outputs.repo_name }}
branch: ${{ steps.gather_facts.outputs.branch }}
base: ${{ steps.gather_facts.outputs.base }}
is_major: ${{ steps.gather_facts.outputs.is_major }}
skip: ${{ steps.pr_exists.outputs.skip }}
version: ${{ steps.gather_facts.outputs.version }}
steps:
Expand Down Expand Up @@ -81,6 +82,7 @@ jobs:
version_major=$((version_major+1))
version_minor=0
version_patch=0
echo "::set-output name=is_major::true"
;;
*)
echo "Unknown Semver level provided"
Expand All @@ -90,6 +92,12 @@ jobs:
version="${version_major}.${version_minor}.${version_patch}"
else
version="${version#v}" # Strip "v" prefix.
version_major=$(echo "${version}" | cut -d "." -f 1)
version_minor=$(echo "${version}" | cut -d "." -f 2)
version_patch=$(echo "${version}" | cut -d "." -f 3)
if [[ $version_minor = 0 && $version_patch = 0 ]]; then
echo "::set-output name=is_major::true"
fi
fi
repo_name="$(echo '${{ github.repository }}' | awk -F '/' '{print $2}')"
echo "repo_name=\"$repo_name\" base=\"$base\" head=\"$head\" version=\"$version\""
Expand Down Expand Up @@ -117,6 +125,9 @@ jobs:
env:
architect_flags: "--organisation ${{ github.repository_owner }} --project ${{ needs.gather_facts.outputs.repo_name }}"
steps:
- uses: actions/setup-go@v3
with:
go-version: '=1.18.1'
- name: Install architect
uses: giantswarm/install-binary-action@v1.0.0
with:
Expand All @@ -129,12 +140,62 @@ jobs:
- name: Prepare release changes
run: |
architect prepare-release ${{ env.architect_flags }} --version "${{ needs.gather_facts.outputs.version }}"
- name: Update version field in Chart.yaml
run: |
# Define chart_dir
repository="${{ needs.gather_facts.outputs.repo_name }}"
chart="helm/${repository}"
# Check chart directory.
if [ ! -d "${chart}" ]
then
echo "Could not find chart directory '${chart}', adding app suffix."
# Add app suffix.
chart="helm/${repository}-app"
# Check chart directory with app suffix.
if [ ! -d "${chart}" ]
then
echo "Could not find chart directory '${chart}', removing app suffix."
# Remove app suffix.
chart="helm/${repository%-app}"
if [ ! -d "${chart}" ]
then
# Print error.
echo "Could not find chart directory '${chart}', doing nothing."
fi
fi
fi
# Define chart YAML.
chart_yaml="${chart}/Chart.yaml"
# Check chart YAML.
if [ -f "${chart_yaml}" ]
then
# check if version in Chart.yaml is templated using architect
if [ $(grep -c "^version:.*\.Version.*$" "${chart_yaml}") = "0" ]; then
yq -i '.version = "${{ needs.gather_facts.outputs.version }}"' "${chart_yaml}"
fi
fi
- name: Bump go module defined in go.mod if needed
run: |
if [ "${{ needs.gather_facts.outputs.is_major }}" = true ] && test -f "go.mod"; then
go install github.com/marwan-at-work/mod/cmd/mod@v0.4.2
mod upgrade
fi
- name: Set up git identity
run: |
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
- name: Create release commit
env:
version: "${{ needs.gather_facts.outputs.version }}"
run: |
git config --local user.email "action@github.com"
git config --local user.name "github-actions"
git add -A
git commit -m "Release v${{ env.version }}"
- name: Push changes
Expand All @@ -148,4 +209,4 @@ jobs:
base: "${{ needs.gather_facts.outputs.base }}"
version: "${{ needs.gather_facts.outputs.version }}"
run: |
hub pull-request -f -m "Release v${{ env.version }}" -a ${{ github.actor }} -b ${{ env.base }} -h ${{ needs.gather_facts.outputs.branch }}
hub pull-request -f -m "Release v${{ env.version }}" -a ${{ github.actor }} -b ${{ env.base }} -h ${{ needs.gather_facts.outputs.branch }}
2 changes: 1 addition & 1 deletion .github/workflows/zz_generated.gitleaks.yaml
@@ -1,6 +1,6 @@
# DO NOT EDIT. Generated with:
#
# devctl@4.20.1
# devctl@5.8.0
#
name: gitleaks

Expand Down
2 changes: 2 additions & 0 deletions .nancy-ignore.generated
@@ -0,0 +1,2 @@
# This file is generated by https://github.com/giantswarm/github
# Repository specific ignores should be added to .nancy-ignore
49 changes: 30 additions & 19 deletions .pre-commit-config.yaml
@@ -1,20 +1,31 @@
minimum_pre_commit_version: '2.17'
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.4.0
hooks:
- id: end-of-file-fixer
- id: trailing-whitespace
- id: no-commit-to-branch
args: [--branch, master, --branch, main, --pattern, release-*]
- id: check-merge-conflict
- repo: https://github.com/tekwizely/pre-commit-golang
rev: v0.8.1
hooks:
- id: go-test-repo-mod
- repo: git://github.com/dnephin/pre-commit-golang
rev: ac0f6582d2484b3aa90b05d568e70f9f3c1374c7
hooks:
- id: go-imports
- id: golangci-lint
- id: go-build
- id: go-mod-tidy
# shell scripts
- repo: https://github.com/detailyang/pre-commit-shell
rev: 1.0.5
hooks:
- id: shell-lint
args: [ --format=json ]

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
hooks:
- id: check-added-large-files
# check for unresolved merge conflicts
- id: check-merge-conflict
- id: check-shebang-scripts-are-executable
- id: detect-private-key
- id: end-of-file-fixer
- id: mixed-line-ending
- id: trailing-whitespace

- repo: https://github.com/dnephin/pre-commit-golang
rev: v0.5.0
hooks:
- id: go-fmt
- id: go-mod-tidy
- id: golangci-lint
# timeout is needed for CI
args: [ -E, gosec, -E, goconst, -E, govet, --timeout, 300s ]
- id: go-imports
args: [ -local, github.com/giantswarm/kvm-operator ]
2 changes: 1 addition & 1 deletion Makefile
@@ -1,6 +1,6 @@
# DO NOT EDIT. Generated with:
#
# devctl@4.20.1
# devctl@5.8.0
#

include Makefile.*.mk
Expand Down
2 changes: 1 addition & 1 deletion Makefile.gen.app.mk
@@ -1,6 +1,6 @@
# DO NOT EDIT. Generated with:
#
# devctl@4.20.1
# devctl@5.8.0
#

##@ App
Expand Down
19 changes: 17 additions & 2 deletions Makefile.gen.go.mk
@@ -1,6 +1,6 @@
# DO NOT EDIT. Generated with:
#
# devctl@4.20.1
# devctl@5.8.0
#

APPLICATION := $(shell go list -m | cut -d '/' -f 3)
Expand All @@ -21,7 +21,7 @@ LDFLAGS ?= -w -linkmode 'auto' -extldflags '$(EXTLDFLAGS)' \

##@ Go

.PHONY: build build-darwin build-darwin-64 build-linux build-linux-arm64
.PHONY: build build-darwin build-darwin-64 build-linux build-linux-arm64 build-windows-amd64
build: $(APPLICATION) ## Builds a local binary.
@echo "====> $@"
build-darwin: $(APPLICATION)-darwin ## Builds a local binary for darwin/amd64.
Expand All @@ -32,6 +32,8 @@ build-linux: $(APPLICATION)-linux ## Builds a local binary for linux/amd64.
@echo "====> $@"
build-linux-arm64: $(APPLICATION)-linux-arm64 ## Builds a local binary for linux/arm64.
@echo "====> $@"
build-windows-amd64: $(APPLICATION)-windows-amd64.exe ## Builds a local binary for windows/amd64.
@echo "====> $@"

$(APPLICATION): $(APPLICATION)-v$(VERSION)-$(OS)-amd64
@echo "====> $@"
Expand All @@ -53,6 +55,10 @@ $(APPLICATION)-linux-arm64: $(APPLICATION)-v$(VERSION)-linux-arm64
@echo "====> $@"
cp -a $< $@

$(APPLICATION)-windows-amd64.exe: $(APPLICATION)-v$(VERSION)-windows-amd64.exe
@echo "====> $@"
cp -a $< $@

$(APPLICATION)-v$(VERSION)-%-amd64: $(SOURCES)
@echo "====> $@"
CGO_ENABLED=0 GOOS=$* GOARCH=amd64 go build -ldflags "$(LDFLAGS)" -o $@ .
Expand All @@ -61,6 +67,10 @@ $(APPLICATION)-v$(VERSION)-%-arm64: $(SOURCES)
@echo "====> $@"
CGO_ENABLED=0 GOOS=$* GOARCH=arm64 go build -ldflags "$(LDFLAGS)" -o $@ .

$(APPLICATION)-v$(VERSION)-windows-amd64.exe: $(SOURCES)
@echo "====> $@"
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -ldflags "$(LDFLAGS)" -o $@ .

.PHONY: install
install: ## Install the application.
@echo "====> $@"
Expand All @@ -87,6 +97,11 @@ lint: ## Runs golangci-lint.
@echo "====> $@"
golangci-lint run -E gosec -E goconst --timeout=15m ./...

.PHONY: nancy
nancy: ## Runs nancy (requires v1.0.37 or newer).
@echo "====> $@"
CGO_ENABLED=0 go list -json -m all | nancy sleuth --skip-update-check --quiet --exclude-vulnerability-file ./.nancy-ignore --additional-exclude-vulnerability-files ./.nancy-ignore.generated

.PHONY: test
test: ## Runs go test with default values.
@echo "====> $@"
Expand Down

0 comments on commit eae0a53

Please sign in to comment.