Skip to content

Commit

Permalink
Use editorconfig-checker (woodpecker-ci#982)
Browse files Browse the repository at this point in the history
  • Loading branch information
6543 authored Jun 17, 2022
1 parent 14b3cff commit 0847939
Show file tree
Hide file tree
Showing 10 changed files with 60 additions and 41 deletions.
14 changes: 14 additions & 0 deletions .ecrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"Exclude": [
".git",
"go.mod", "go.sum",
"vendor",
"fixtures",
"LICENSE",
"node_modules",
"server/store/datastore/migration/testfiles/sqlite.db",
"server/store/datastore/feed.go",
"_test.go",
"Makefile"
]
}
1 change: 1 addition & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ indent_style = tab

[*.md]
trim_trailing_whitespace = false
indent_size = 1

[Makefile]
indent_style = tab
12 changes: 6 additions & 6 deletions .woodpecker/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ pipeline:
when:
event: [push, pull_request]
path:
- "docs/**"
- ".woodpecker/docs.yml"
- "docs/**"
- ".woodpecker/docs.yml"

deploy-preview:
image: woodpeckerci/plugin-surge-preview:next
Expand All @@ -24,8 +24,8 @@ pipeline:
when:
event: pull_request
path:
- "docs/**"
- ".woodpecker/docs.yml"
- "docs/**"
- ".woodpecker/docs.yml"
# TODO: add step to remove preview again after PR is closed (waiting for #286)

deploy:
Expand Down Expand Up @@ -53,6 +53,6 @@ pipeline:
event: push
branch: ${CI_REPO_DEFAULT_BRANCH}
path:
- "docs/**"
- ".woodpecker/docs.yml"
- "docs/**"
- ".woodpecker/docs.yml"

4 changes: 4 additions & 0 deletions .woodpecker/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ pipeline:
- "**/*.go"
- "go.*"

lint-editorconfig:
image: mstruebing/editorconfig-checker
group: test

test:
image: golang:1.18
group: test
Expand Down
4 changes: 2 additions & 2 deletions charts/woodpecker-server/templates/NOTES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
echo http://$NODE_IP:$NODE_PORT
{{- else if contains "LoadBalancer" .Values.service.type }}
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "woodpecker-server.fullname" . }}'
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "woodpecker-server.fullname" . }}'
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "woodpecker-server.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}")
echo http://$SERVICE_IP:{{ .Values.service.port }}
{{- else if contains "ClusterIP" .Values.service.type }}
Expand Down
1 change: 1 addition & 0 deletions docs/docs/91-migrations.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ Some versions need some changes to the server configuration or the pipeline conf
- `drone.sqlite` -> `woodpecker.sqlite`

- Plugin Settings moved into `settings` section:

```diff
pipline:
something:
Expand Down
11 changes: 5 additions & 6 deletions docs/docs/92-development/06-guides.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ Woodpecker uses migrations to change the database schema if a database model has
package migration

import (
"xorm.io/xorm"
"xorm.io/xorm"
)

var alterTableReposDropCounter = task{
name: "alter-table-drop-counter",
fn: func(sess *xorm.Session) error {
return dropTableColumns(sess, "repos", "repo_counter")
},
name: "alter-table-drop-counter",
fn: func(sess *xorm.Session) error {
return dropTableColumns(sess, "repos", "repo_counter")
},
}
```

Expand All @@ -33,4 +33,3 @@ You should not use `sess.Begin()`, `sess.Commit()` or `sess.Close()` inside a mi
:::

To automatically execute the migration after the start of the server, the new migration needs to be added to the end of `migrationTasks` in `server/store/datastore/migration/migration.go`. After a successful execution of that transaction the server will automatically add the migration to a list, so it won't be executed again on the next start.

6 changes: 3 additions & 3 deletions server/api/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -380,8 +380,8 @@ func DeleteBuildLogs(c *gin.Context) {

var deleteStr = `[
{
"proc": %q,
"pos": 0,
"out": "logs purged by %s on %s\n"
"proc": %q,
"pos": 0,
"out": "logs purged by %s on %s\n"
}
]`
8 changes: 4 additions & 4 deletions server/store/datastore/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@ func (s storage) ConfigFindApproved(config *model.Config) (bool, error) {
SELECT build_id FROM builds
WHERE build_repo_id = ?
AND build_id in (
SELECT build_id
FROM build_config
WHERE build_config.config_id = ?
)
SELECT build_id
FROM build_config
WHERE build_config.config_id = ?
)
AND build_status NOT IN ('blocked', 'pending')
LIMIT 1
`, config.RepoID, config.ID).Count()
Expand Down
40 changes: 20 additions & 20 deletions woodpecker-go/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,34 +2,34 @@

```Go
import (
"github.com/woodpecker-ci/woodpecker/woodpecker-go/woodpecker"
"golang.org/x/oauth2"
"github.com/woodpecker-ci/woodpecker/woodpecker-go/woodpecker"
"golang.org/x/oauth2"
)

const (
token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9"
host = "http://woodpecker.company.tld"
token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9"
host = "http://woodpecker.company.tld"
)

func main() {
// create an http client with oauth authentication.
config := new(oauth2.Config)
authenticator := config.Client(
oauth2.NoContext,
&oauth2.Token{
AccessToken: token,
},
)
// create an http client with oauth authentication.
config := new(oauth2.Config)
authenticator := config.Client(
oauth2.NoContext,
&oauth2.Token{
AccessToken: token,
},
)

// create the woodpecker client with authenticator
client := woodpecker.NewClient(host, authenticator)
// create the woodpecker client with authenticator
client := woodpecker.NewClient(host, authenticator)

// gets the current user
user, err := client.Self()
fmt.Println(user, err)
// gets the current user
user, err := client.Self()
fmt.Println(user, err)

// gets the named repository information
repo, err := client.Repo("woodpecker-ci", "woodpecker")
fmt.Println(repo, err)
// gets the named repository information
repo, err := client.Repo("woodpecker-ci", "woodpecker")
fmt.Println(repo, err)
}
```

0 comments on commit 0847939

Please sign in to comment.