Skip to content

Commit

Permalink
Align files (#910)
Browse files Browse the repository at this point in the history
* Align files

* Remove indentation

* Added read header timeout and fixed deprecations

* Fixed indentation in error printer test

* Fixed indentation in errorprinter test

* Improved indentation in errorprinter test

Co-authored-by: github-actions <action@github.com>
Co-authored-by: Marian Steinbach <marian@giantswarm.io>
Co-authored-by: vvondruska <vondruska.vaclav@gmail.com>
  • Loading branch information
4 people committed Oct 12, 2022
1 parent 14a90cf commit db33023
Show file tree
Hide file tree
Showing 35 changed files with 89 additions and 80 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: 2.1

orbs:
architect: giantswarm/architect@4.24.0
architect: giantswarm/architect@4.25.0

jobs:
debug-tag:
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/zz_generated.add-team-labels.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Add Issue to Project when assigned
name: Add appropriate labels to issue

on:
issues:
Expand All @@ -9,10 +9,10 @@ jobs:
name: Get yaml config of GS users
runs-on: ubuntu-latest
steps:
- name: Fetch issue templates
- name: Get user-mapping
run: |
mkdir -p artifacts
wget --header "Authorization: token ${{ github.token }}" \
wget --header "Authorization: token ${{ secrets.ISSUE_AUTOMATION }}" \
-O artifacts/users.yaml \
https://raw.githubusercontent.com/giantswarm/github/master/tools/issue-automation/user-mapping.yaml
- name: Upload Artifact
Expand Down Expand Up @@ -48,6 +48,6 @@ jobs:
if: ${{ env.LABEL != '' }}
uses: actions-ecosystem/action-add-labels@v1
with:
github-token: ${{ secrets.ISSUE_AUTOMATION }}
github_token: ${{ secrets.ISSUE_AUTOMATION }}
labels: |
${{ env.LABEL }}
16 changes: 10 additions & 6 deletions .github/workflows/zz_generated.add-to-project-board.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ name: Add Issue to Project when assigned

on:
issues:
types: [assigned]
types:
- assigned
- labeled

jobs:
build_user_list:
Expand All @@ -12,7 +14,7 @@ jobs:
- name: Get user-mapping
run: |
mkdir -p artifacts
wget --header "Authorization: token ${{ github.token }}" \
wget --header "Authorization: token ${{ secrets.ISSUE_AUTOMATION }}" \
-O artifacts/users.yaml \
https://raw.githubusercontent.com/giantswarm/github/master/tools/issue-automation/user-mapping.yaml
- name: Upload Artifact
Expand All @@ -24,7 +26,7 @@ jobs:
- name: Get label-mapping
run: |
mkdir -p artifacts
wget --header "Authorization: token ${{ github.token }}" \
wget --header "Authorization: token ${{ secrets.ISSUE_AUTOMATION }}" \
-O artifacts/labels.yaml \
https://raw.githubusercontent.com/giantswarm/github/master/tools/issue-automation/label-mapping.yaml
- name: Upload Artifact
Expand All @@ -38,6 +40,7 @@ jobs:
name: Add issue to personal board
runs-on: ubuntu-latest
needs: build_user_list
if: github.event.action == 'assigned'
steps:
- uses: actions/download-artifact@v3
id: download-users
Expand All @@ -60,20 +63,21 @@ jobs:
github-token: ${{ secrets.ISSUE_AUTOMATION }}

add_to_team_board:
name: Add issue to personal board
name: Add issue to team board
runs-on: ubuntu-latest
needs: build_user_list
if: github.event.action == 'labeled'
steps:
- uses: actions/download-artifact@v3
id: download-labels
with:
name: labels
- name: Find team board based on label
run: |
event_label=$(cat $GITHUB_EVENT_PATH | jq -r .label | tr '[:upper:]' '[:lower:]')
event_label=$(cat $GITHUB_EVENT_PATH | jq -r .label.name | tr '[:upper:]' '[:lower:]')
echo "Issue labelled with: ${event_label}"
BOARD=($(cat ${{steps.download-users.outputs.download-path}}/labels.yaml | tr '[:upper:]' '[:lower:]' | yq ".${event_label}.projectBoard"))
BOARD=($(cat ${{steps.download-labels.outputs.download-path}}/labels.yaml | tr '[:upper:]' '[:lower:]' | yq ".${event_label}.projectboard"))
echo "Team board URL: ${BOARD}"
echo "BOARD=${BOARD}" >> $GITHUB_ENV
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/zz_generated.create_release.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# DO NOT EDIT. Generated with:
#
# devctl@5.9.0
# devctl@5.10.0
#
name: Create Release
on:
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/zz_generated.create_release_pr.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# DO NOT EDIT. Generated with:
#
# devctl@5.9.0
# devctl@5.10.0
#
name: Create Release PR
on:
Expand Down Expand Up @@ -95,7 +95,9 @@ jobs:
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
# This will help us detect versions with suffixes as majors, i.e 3.0.0-alpha1.
# Even though it's a pre-release, it's still a major.
if [[ $version_minor = 0 && $version_patch =~ ^0.* ]]; then
echo "::set-output name=is_major::true"
fi
fi
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/zz_generated.gitleaks.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# DO NOT EDIT. Generated with:
#
# devctl@5.9.0
# devctl@5.10.0
#
name: gitleaks

Expand Down
2 changes: 1 addition & 1 deletion .github/zz_generated.windows-code-signing.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# DO NOT EDIT. Generated with:
#
# devctl@5.9.0
# devctl@5.10.0
#

APPLICATION=$1
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ repos:
- id: trailing-whitespace

- repo: https://github.com/dnephin/pre-commit-golang
rev: v0.5.0
rev: v0.5.1
hooks:
- id: go-fmt
- id: go-mod-tidy
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project's packages adheres to [Semantic Versioning](http://semver.org/s

## [Unreleased]

### Added

- Added read header timeout to http server

## [2.24.1] - 2022-10-12

### Fixed
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# DO NOT EDIT. Generated with:
#
# devctl@5.9.0
# devctl@5.10.0
#

include Makefile.*.mk
Expand Down
2 changes: 1 addition & 1 deletion Makefile.gen.go.mk
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# DO NOT EDIT. Generated with:
#
# devctl@5.9.0
# devctl@5.10.0
#

PACKAGE_DIR := ./bin-dist
Expand Down
3 changes: 1 addition & 2 deletions cmd/get/clusters/printer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ var update = goflag.Bool("update", false, "update .golden reference test files")

// Test_printOutput uses golden files.
//
// go test ./cmd/get/clusters -run Test_printOutput -update
//
// go test ./cmd/get/clusters -run Test_printOutput -update
func Test_printOutput(t *testing.T) {
testCases := []struct {
name string
Expand Down
3 changes: 1 addition & 2 deletions cmd/get/clusters/runner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ import (

// Test_run uses golden files.
//
// go test ./cmd/get/clusters -run Test_run -update
//
// go test ./cmd/get/clusters -run Test_run -update
func Test_run(t *testing.T) {
testCases := []struct {
name string
Expand Down
3 changes: 1 addition & 2 deletions cmd/get/nodepools/runner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ import (

// Test_run uses golden files.
//
// go test ./cmd/get/nodepools -run Test_run -update
//
// go test ./cmd/get/nodepools -run Test_run -update
func Test_run(t *testing.T) {
testCases := []struct {
name string
Expand Down
8 changes: 5 additions & 3 deletions cmd/login/oidc.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ const (
customerConnectorID = "customer"
giantswarmConnectorID = "giantswarm"

oidcResultTimeout = 1 * time.Minute
oidcResultTimeout = 1 * time.Minute
oidcReadHeaderTimeout = 1 * time.Minute
)

var (
Expand All @@ -45,8 +46,9 @@ func handleOIDC(ctx context.Context, out io.Writer, errOut io.Writer, i *install
var authProxy *callbackserver.CallbackServer
{
config := callbackserver.Config{
Port: port,
RedirectURI: oidcCallbackPath,
Port: port,
RedirectURI: oidcCallbackPath,
ReadHeaderTimeout: oidcReadHeaderTimeout,
}
authProxy, err = callbackserver.New(config)
if err != nil {
Expand Down
3 changes: 1 addition & 2 deletions cmd/template/cluster/runner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ var update = goflag.Bool("update", false, "update .golden reference test files")

// Test_run uses golden files.
//
// go test ./cmd/template/cluster -run Test_run -update
//
// go test ./cmd/template/cluster -run Test_run -update
func Test_run(t *testing.T) {
testCases := []struct {
name string
Expand Down
3 changes: 1 addition & 2 deletions cmd/template/organization/runner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ var update = goflag.Bool("update", false, "update .golden reference test files")

// TestRunner_Run uses golden files.
//
// go test ./cmd/template/organization -run TestRunner_Run -update
//
// go test ./cmd/template/organization -run TestRunner_Run -update
func TestRunner_Run(t *testing.T) {
testCases := []struct {
name string
Expand Down
4 changes: 2 additions & 2 deletions cmd/validate/apps/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package apps
import (
"context"
"io"
"io/ioutil"
"os"

"github.com/giantswarm/microerror"
"github.com/giantswarm/micrologger"
Expand Down Expand Up @@ -68,7 +68,7 @@ func (r *runner) run(ctx context.Context, cmd *cobra.Command, args []string) err

var valuesSchema string
if valuesSchemaFilePath != "" {
valuesSchemaFile, err := ioutil.ReadFile(valuesSchemaFilePath)
valuesSchemaFile, err := os.ReadFile(valuesSchemaFilePath)
if err != nil {
return microerror.Mask(err)
}
Expand Down
11 changes: 5 additions & 6 deletions internal/gitops/filesystem/creator/creator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package creator
import (
"bytes"
"fmt"
"io/ioutil"
"os"
"strings"
"testing"
Expand Down Expand Up @@ -152,7 +151,7 @@ func Test_Create(t *testing.T) {
continue
}

data, err := ioutil.ReadFile(tfo.InputData)
data, err := os.ReadFile(tfo.InputData)
if err != nil {
t.Fatalf("unexpected error: %s", err.Error())
}
Expand All @@ -166,7 +165,7 @@ func Test_Create(t *testing.T) {
tc.creator.fsObjects = fsObjects

if !tc.creator.dryRun {
tmpDir, err = ioutil.TempDir("", "creator-test")
tmpDir, err = os.MkdirTemp("", "creator-test")

if err != nil {
t.Fatalf("unexpected error: %s", err.Error())
Expand All @@ -190,7 +189,7 @@ func Test_Create(t *testing.T) {
}

if tc.expectedDryRun != "" {
expected, err := ioutil.ReadFile(tc.expectedDryRun)
expected, err := os.ReadFile(tc.expectedDryRun)
if err != nil {
t.Fatalf("unexpected error: %s", err.Error())
}
Expand All @@ -216,12 +215,12 @@ func Test_Create(t *testing.T) {
continue
}

got, err := ioutil.ReadFile(fmt.Sprintf("%s/%s", tc.creator.path, p))
got, err := os.ReadFile(fmt.Sprintf("%s/%s", tc.creator.path, p))
if err != nil {
t.Fatalf("unexpected error: %s", err.Error())
}

expected, err := ioutil.ReadFile(c)
expected, err := os.ReadFile(c)
if err != nil {
t.Fatalf("unexpected error: %s", err.Error())
}
Expand Down
4 changes: 2 additions & 2 deletions internal/gitops/structure/app/app_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package app
import (
"bytes"
"fmt"
"io/ioutil"
"os"
"testing"
"time"

Expand Down Expand Up @@ -308,7 +308,7 @@ topKey:
continue
}

expected, err := ioutil.ReadFile(e.GoldenFile)
expected, err := os.ReadFile(e.GoldenFile)
if err != nil {
t.Fatalf("unexpected error: %s", err.Error())
}
Expand Down
4 changes: 2 additions & 2 deletions internal/gitops/structure/management-cluster/cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package mcluster
import (
"bytes"
"fmt"
"io/ioutil"
"os"
"testing"

"github.com/google/go-cmp/cmp"
Expand Down Expand Up @@ -111,7 +111,7 @@ func Test_NewManagementCluster(t *testing.T) {
continue
}

expected, err := ioutil.ReadFile(e.GoldenFile)
expected, err := os.ReadFile(e.GoldenFile)
if err != nil {
t.Fatalf("unexpected error: %s", err.Error())
}
Expand Down
4 changes: 2 additions & 2 deletions internal/gitops/structure/organization/organization_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package organization
import (
"bytes"
"fmt"
"io/ioutil"
"os"
"testing"

"github.com/google/go-cmp/cmp"
Expand Down Expand Up @@ -67,7 +67,7 @@ func Test_NewOrganization(t *testing.T) {
continue
}

expected, err := ioutil.ReadFile(e.GoldenFile)
expected, err := os.ReadFile(e.GoldenFile)
if err != nil {
t.Fatalf("unexpected error: %s", err.Error())
}
Expand Down
4 changes: 2 additions & 2 deletions internal/gitops/structure/updates/updates_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package updates
import (
"bytes"
"fmt"
"io/ioutil"
"os"
"testing"

"github.com/google/go-cmp/cmp"
Expand Down Expand Up @@ -101,7 +101,7 @@ func Test_NewAutomaticUpdate(t *testing.T) {
continue
}

expected, err := ioutil.ReadFile(e.GoldenFile)
expected, err := os.ReadFile(e.GoldenFile)
if err != nil {
t.Fatalf("unexpected error: %s", err.Error())
}
Expand Down

0 comments on commit db33023

Please sign in to comment.