Compare commits
1 commit
master
...
tphoney-pa
Author | SHA1 | Date | |
---|---|---|---|
|
e41980e587 |
16 changed files with 22 additions and 159 deletions
|
@ -1,4 +1,5 @@
|
|||
---
|
||||
|
||||
kind: pipeline
|
||||
type: docker
|
||||
name: linux-amd64
|
||||
|
|
6
.github/issue_template.md
vendored
6
.github/issue_template.md
vendored
|
@ -4,9 +4,9 @@ Bugs or Issues? Please create a new topic in our Discourse forum.
|
|||
We are migrating all Drone repositories to Discourse for bug tracking.
|
||||
New GitHub issues may be automatically deleted.
|
||||
|
||||
https://community.harness.io/
|
||||
https://community.harness.io/c/bugs/17
|
||||
https://community.harness.io/c/ideas/11
|
||||
https://discourse.drone.io/
|
||||
https://discourse.drone.io/c/bugs
|
||||
https://discourse.drone.io/c/ideas
|
||||
|
||||
Failing Builds? Please do not use GitHub issues for generic support
|
||||
questions. Instead please use Stack Overflow:
|
||||
|
|
21
CHANGELOG.md
21
CHANGELOG.md
|
@ -1,24 +1,6 @@
|
|||
# Changelog
|
||||
|
||||
## [v2.12.1](https://github.com/harness/drone/tree/v2.12.1) (2022-06-15)
|
||||
|
||||
[Full Changelog](https://github.com/harness/drone/compare/v2.12.0...v2.12.1)
|
||||
|
||||
**Fixed bugs:**
|
||||
|
||||
- \(bug\) - fix original template scripts & remove amend scripts [\#3229](https://github.com/harness/drone/pull/3229) ([eoinmcafee00](https://github.com/eoinmcafee00))
|
||||
- \(bug\) - remove unique index on template name [\#3226](https://github.com/harness/drone/pull/3226) ([eoinmcafee00](https://github.com/eoinmcafee00))
|
||||
- Added OAuth2 token refresher for Gitlab [\#3215](https://github.com/harness/drone/pull/3215) ([EndymionWight](https://github.com/EndymionWight))
|
||||
|
||||
**Merged pull requests:**
|
||||
|
||||
- \(maint\) fix starlark test on windows [\#3230](https://github.com/harness/drone/pull/3230) ([tphoney](https://github.com/tphoney))
|
||||
- \(maint\) fix unit tests so they pass on windows [\#3228](https://github.com/harness/drone/pull/3228) ([tphoney](https://github.com/tphoney))
|
||||
- Update Readme to Fix Typo [\#3223](https://github.com/harness/drone/pull/3223) ([hrittikhere](https://github.com/hrittikhere))
|
||||
- \(bug\) add unit test for comments in template file [\#3221](https://github.com/harness/drone/pull/3221) ([eoinmcafee00](https://github.com/eoinmcafee00))
|
||||
- Bump scm version to v1.24.0 [\#3219](https://github.com/harness/drone/pull/3219) ([kit101](https://github.com/kit101))
|
||||
|
||||
## [v2.12.0](https://github.com/harness/drone/tree/v2.12.0) (2022-05-16)
|
||||
## [v2.12.0](https://github.com/harness/drone/tree/v2.12.0) (2022-05-13)
|
||||
|
||||
[Full Changelog](https://github.com/harness/drone/compare/v2.11.1...v2.12.0)
|
||||
|
||||
|
@ -34,7 +16,6 @@
|
|||
|
||||
**Merged pull requests:**
|
||||
|
||||
- release prep v2.12.0 [\#3214](https://github.com/harness/drone/pull/3214) ([tphoney](https://github.com/tphoney))
|
||||
- fixing URL [\#3208](https://github.com/harness/drone/pull/3208) ([dnielsen](https://github.com/dnielsen))
|
||||
- update community information with updated links [\#3199](https://github.com/harness/drone/pull/3199) ([mrsantons](https://github.com/mrsantons))
|
||||
|
||||
|
|
|
@ -180,13 +180,7 @@ func provideGitlabClient(config config.Config) *scm.Client {
|
|||
}
|
||||
client.Client = &http.Client{
|
||||
Transport: &oauth2.Transport{
|
||||
Scheme: oauth2.SchemeBearer,
|
||||
Source: &oauth2.Refresher{
|
||||
ClientID: config.GitLab.ClientID,
|
||||
ClientSecret: config.GitLab.ClientSecret,
|
||||
Endpoint: strings.TrimSuffix(config.GitLab.Server, "/") + "/oauth/token",
|
||||
Source: oauth2.ContextTokenSource(),
|
||||
},
|
||||
Source: oauth2.ContextTokenSource(),
|
||||
Base: defaultTransport(config.GitLab.SkipVerify),
|
||||
},
|
||||
}
|
||||
|
|
|
@ -197,14 +197,6 @@ func provideRefresher(config config.Config) *oauth2.Refresher {
|
|||
Source: oauth2.ContextTokenSource(),
|
||||
Client: defaultClient(config.Gitea.SkipVerify),
|
||||
}
|
||||
case config.GitLab.ClientID != "":
|
||||
return &oauth2.Refresher{
|
||||
ClientID: config.GitLab.ClientID,
|
||||
ClientSecret: config.GitLab.ClientSecret,
|
||||
Endpoint: strings.TrimSuffix(config.GitLab.Server, "/") + "/oauth/token",
|
||||
Source: oauth2.ContextTokenSource(),
|
||||
Client: defaultClient(config.GitLab.SkipVerify),
|
||||
}
|
||||
case config.Gitee.ClientID != "":
|
||||
return &oauth2.Refresher{
|
||||
ClientID: config.Gitee.ClientID,
|
||||
|
|
|
@ -2,8 +2,6 @@ package jsonnet
|
|||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"runtime"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/drone/drone/core"
|
||||
|
@ -46,19 +44,13 @@ func TestParse(t *testing.T) {
|
|||
|
||||
req.Config.Data = string(before)
|
||||
|
||||
got, err := Parse(req, nil, 0, template, templateData)
|
||||
parsedFile, err := Parse(req, nil, 0, template, templateData)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
|
||||
want := string(after)
|
||||
// on windows line endings are \r\n, lets change them to linux for comparison
|
||||
if runtime.GOOS == "windows" {
|
||||
want = strings.Replace(want, "\r\n", "\n", -1)
|
||||
}
|
||||
|
||||
if want != got {
|
||||
if want, got := parsedFile, string(after); want != got {
|
||||
t.Errorf("Want %q got %q", want, got)
|
||||
}
|
||||
}
|
||||
|
@ -90,19 +82,13 @@ func TestParseJsonnetNotTemplateFile(t *testing.T) {
|
|||
req.Repo.Config = "plugin.jsonnet"
|
||||
req.Config.Data = string(before)
|
||||
|
||||
got, err := Parse(req, nil, 0, nil, nil)
|
||||
parsedFile, err := Parse(req, nil, 0, nil, nil)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
|
||||
want := string(after)
|
||||
// on windows line endings are \r\n, lets change them to linux for comparison
|
||||
if runtime.GOOS == "windows" {
|
||||
want = strings.Replace(want, "\r\n", "\n", -1)
|
||||
}
|
||||
|
||||
if want != got {
|
||||
if want, got := parsedFile, string(after); want != got {
|
||||
t.Errorf("Want %q got %q", want, got)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,8 +16,6 @@ package converter
|
|||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"runtime"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/drone/drone/core"
|
||||
|
@ -119,14 +117,7 @@ func TestConvert_Multi(t *testing.T) {
|
|||
return
|
||||
}
|
||||
|
||||
want := string(after)
|
||||
// on windows line endings are \r\n, lets change them to linux for comparison
|
||||
if runtime.GOOS == "windows" {
|
||||
want = strings.Replace(want, "\r\n", "\n", -1)
|
||||
}
|
||||
|
||||
got := config.Data
|
||||
if want != got {
|
||||
if want, got := config.Data, string(after); want != got {
|
||||
t.Errorf("Want %q got %q", want, got)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,8 +17,6 @@ package converter
|
|||
import (
|
||||
"encoding/json"
|
||||
"io/ioutil"
|
||||
"runtime"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/drone/drone/core"
|
||||
|
@ -236,14 +234,7 @@ func TestTemplatePluginConvertJsonnet(t *testing.T) {
|
|||
return
|
||||
}
|
||||
|
||||
want := string(after)
|
||||
// on windows line endings are \r\n, lets change them to linux for comparison
|
||||
if runtime.GOOS == "windows" {
|
||||
want = strings.Replace(want, "\r\n", "\n", -1)
|
||||
}
|
||||
|
||||
got := config.Data
|
||||
if want != got {
|
||||
if want, got := config.Data, string(after); want != got {
|
||||
t.Errorf("Want %q got %q", want, got)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -48,7 +48,6 @@ func Connect() (*db.DB, error) {
|
|||
func Reset(d *db.DB) {
|
||||
d.Lock(func(tx db.Execer, _ db.Binder) error {
|
||||
tx.Exec("DELETE FROM cron")
|
||||
tx.Exec("DELETE FROM cards")
|
||||
tx.Exec("DELETE FROM logs")
|
||||
tx.Exec("DELETE FROM steps")
|
||||
tx.Exec("DELETE FROM stages")
|
||||
|
@ -57,7 +56,6 @@ func Reset(d *db.DB) {
|
|||
tx.Exec("DELETE FROM perms")
|
||||
tx.Exec("DELETE FROM repos")
|
||||
tx.Exec("DELETE FROM users")
|
||||
tx.Exec("DELETE FROM templates")
|
||||
tx.Exec("DELETE FROM orgsecrets")
|
||||
return nil
|
||||
})
|
||||
|
|
|
@ -160,10 +160,6 @@ var migrations = []struct {
|
|||
name: "create-table-template",
|
||||
stmt: createTableTemplate,
|
||||
},
|
||||
{
|
||||
name: "create-index-template-namespace",
|
||||
stmt: createIndexTemplateNamespace,
|
||||
},
|
||||
{
|
||||
name: "alter-table-steps-add-column-step-depends-on",
|
||||
stmt: alterTableStepsAddColumnStepDependsOn,
|
||||
|
@ -696,16 +692,14 @@ CREATE INDEX IF NOT EXISTS ix_latest_repo ON latest (latest_repo_id);
|
|||
var createTableTemplate = `
|
||||
CREATE TABLE IF NOT EXISTS templates (
|
||||
template_id SERIAL PRIMARY KEY
|
||||
,template_name TEXT
|
||||
,template_name TEXT UNIQUE
|
||||
,template_namespace VARCHAR(50)
|
||||
,template_data BYTEA
|
||||
,template_created INTEGER
|
||||
,template_updated INTEGER
|
||||
,UNIQUE(template_name, template_namespace)
|
||||
);
|
||||
`
|
||||
|
||||
var createIndexTemplateNamespace = `
|
||||
CREATE INDEX IF NOT EXISTS ix_template_namespace ON templates (template_namespace);
|
||||
`
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
CREATE TABLE IF NOT EXISTS templates (
|
||||
template_id SERIAL PRIMARY KEY
|
||||
,template_name TEXT
|
||||
,template_name TEXT UNIQUE
|
||||
,template_namespace VARCHAR(50)
|
||||
,template_data BYTEA
|
||||
,template_created INTEGER
|
||||
|
@ -10,6 +10,4 @@ CREATE TABLE IF NOT EXISTS templates (
|
|||
,UNIQUE(template_name, template_namespace)
|
||||
);
|
||||
|
||||
-- name: create-index-template-namespace
|
||||
|
||||
CREATE INDEX IF NOT EXISTS ix_template_namespace ON templates (template_namespace);
|
||||
|
|
|
@ -160,10 +160,6 @@ var migrations = []struct {
|
|||
name: "create-table-templates",
|
||||
stmt: createTableTemplates,
|
||||
},
|
||||
{
|
||||
name: "create-index-template-namespace",
|
||||
stmt: createIndexTemplateNamespace,
|
||||
},
|
||||
{
|
||||
name: "alter-table-steps-add-column-step-depends-on",
|
||||
stmt: alterTableStepsAddColumnStepDependsOn,
|
||||
|
@ -698,16 +694,14 @@ CREATE INDEX IF NOT EXISTS ix_latest_repo ON latest (latest_repo_id);
|
|||
var createTableTemplates = `
|
||||
CREATE TABLE IF NOT EXISTS templates (
|
||||
template_id INTEGER PRIMARY KEY AUTOINCREMENT
|
||||
,template_name TEXT
|
||||
,template_name TEXT UNIQUE
|
||||
,template_namespace TEXT COLLATE NOCASE
|
||||
,template_data BLOB
|
||||
,template_created INTEGER
|
||||
,template_updated INTEGER
|
||||
,UNIQUE(template_name COLLATE NOCASE, template_namespace COLLATE NOCASE)
|
||||
,UNIQUE(template_name, template_namespace)
|
||||
);
|
||||
`
|
||||
|
||||
var createIndexTemplateNamespace = `
|
||||
CREATE INDEX IF NOT EXISTS ix_template_namespace ON templates (template_namespace);
|
||||
`
|
||||
|
||||
|
|
|
@ -2,14 +2,12 @@
|
|||
|
||||
CREATE TABLE IF NOT EXISTS templates (
|
||||
template_id INTEGER PRIMARY KEY AUTOINCREMENT
|
||||
,template_name TEXT
|
||||
,template_name TEXT UNIQUE
|
||||
,template_namespace TEXT COLLATE NOCASE
|
||||
,template_data BLOB
|
||||
,template_created INTEGER
|
||||
,template_updated INTEGER
|
||||
,UNIQUE(template_name COLLATE NOCASE, template_namespace COLLATE NOCASE)
|
||||
,UNIQUE(template_name, template_namespace)
|
||||
);
|
||||
|
||||
-- name: create-index-template-namespace
|
||||
|
||||
CREATE INDEX IF NOT EXISTS ix_template_namespace ON templates (template_namespace);
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
// Use of this source code is governed by the Drone Non-Commercial License
|
||||
// that can be found in the LICENSE file.
|
||||
|
||||
//go:build !oss
|
||||
// +build !oss
|
||||
|
||||
package template
|
||||
|
@ -30,7 +29,7 @@ func TestTemplate(t *testing.T) {
|
|||
}()
|
||||
|
||||
store := New(conn).(*templateStore)
|
||||
t.Run("TestTemplates", testTemplateCreate(store))
|
||||
t.Run("Create", testTemplateCreate(store))
|
||||
}
|
||||
|
||||
func testTemplateCreate(store *templateStore) func(t *testing.T) {
|
||||
|
@ -51,8 +50,6 @@ func testTemplateCreate(store *templateStore) func(t *testing.T) {
|
|||
t.Errorf("Want template Id assigned, got %d", item.Id)
|
||||
}
|
||||
|
||||
t.Run("CreateSameNameDiffOrg", testCreateWithSameNameDiffOrg(store))
|
||||
t.Run("CreateSameNameSameOrgShouldError", testCreateSameNameSameOrgShouldError(store))
|
||||
t.Run("Find", testTemplateFind(store, item))
|
||||
t.Run("FindName", testTemplateFindName(store))
|
||||
t.Run("ListAll", testTemplateListAll(store))
|
||||
|
@ -62,43 +59,6 @@ func testTemplateCreate(store *templateStore) func(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func testCreateWithSameNameDiffOrg(store *templateStore) func(t *testing.T) {
|
||||
return func(t *testing.T) {
|
||||
item := &core.Template{
|
||||
Id: 1,
|
||||
Name: "my_template",
|
||||
Namespace: "my_org2",
|
||||
Data: "some_template_data",
|
||||
Created: 1,
|
||||
Updated: 2,
|
||||
}
|
||||
err := store.Create(noContext, item)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
if item.Id == 0 {
|
||||
t.Errorf("Want template Id assigned, got %d", item.Id)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testCreateSameNameSameOrgShouldError(store *templateStore) func(t *testing.T) {
|
||||
return func(t *testing.T) {
|
||||
item := &core.Template{
|
||||
Id: 3,
|
||||
Name: "my_template",
|
||||
Namespace: "my_org2",
|
||||
Data: "some_template_data",
|
||||
Created: 1,
|
||||
Updated: 2,
|
||||
}
|
||||
err := store.Create(noContext, item)
|
||||
if err == nil {
|
||||
t.Error(err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testTemplateFind(store *templateStore, template *core.Template) func(t *testing.T) {
|
||||
return func(t *testing.T) {
|
||||
item, err := store.Find(noContext, template.Id)
|
||||
|
@ -135,20 +95,6 @@ func testTemplate(item *core.Template) func(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func testTemplate2(item *core.Template) func(t *testing.T) {
|
||||
return func(t *testing.T) {
|
||||
if got, want := item.Name, "my_template"; got != want {
|
||||
t.Errorf("Want template name %q, got %q", want, got)
|
||||
}
|
||||
if got, want := item.Data, "some_template_data"; got != want {
|
||||
t.Errorf("Want template data %q, got %q", want, got)
|
||||
}
|
||||
if got, want := item.Namespace, "my_org2"; got != want {
|
||||
t.Errorf("Want template org %q, got %q", want, got)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testTemplateListAll(store *templateStore) func(t *testing.T) {
|
||||
return func(t *testing.T) {
|
||||
list, err := store.ListAll(noContext)
|
||||
|
@ -156,11 +102,10 @@ func testTemplateListAll(store *templateStore) func(t *testing.T) {
|
|||
t.Error(err)
|
||||
return
|
||||
}
|
||||
if got, want := len(list), 2; got != want {
|
||||
if got, want := len(list), 1; got != want {
|
||||
t.Errorf("Want count %d, got %d", want, got)
|
||||
} else {
|
||||
t.Run("Fields", testTemplate(list[0]))
|
||||
t.Run("Fields", testTemplate2(list[1]))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ var (
|
|||
// VersionMinor is for functionality in a backwards-compatible manner.
|
||||
VersionMinor int64 = 12
|
||||
// VersionPatch is for backwards-compatible bug fixes.
|
||||
VersionPatch int64 = 1
|
||||
VersionPatch int64 = 0
|
||||
// VersionPre indicates prerelease.
|
||||
VersionPre = ""
|
||||
// VersionDev indicates development branch. Releases will be empty string.
|
||||
|
|
|
@ -10,7 +10,7 @@ package version
|
|||
import "testing"
|
||||
|
||||
func TestVersion(t *testing.T) {
|
||||
if got, want := Version.String(), "2.12.1"; got != want {
|
||||
if got, want := Version.String(), "2.12.0"; got != want {
|
||||
t.Errorf("Want version %s, got %s", want, got)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue