From e0ed1b3e4914fb0aa7cad08ff22bf72437b70da0 Mon Sep 17 00:00:00 2001 From: Anbraten Date: Mon, 31 Jul 2023 05:47:23 +0200 Subject: [PATCH] Change master to main (#2044) --- .github/ISSUE_TEMPLATE/bug_report.yml | 4 +- .github/ISSUE_TEMPLATE/feature_request.yml | 4 +- .../ISSUE_TEMPLATE/plugin_index.yml.disabled | 37 ----------- README.md | 2 +- cli/deploy/deploy.go | 2 +- cli/pipeline/last.go | 2 +- docs/README.md | 2 +- docs/docs/20-usage/20-pipeline-syntax.md | 20 +++--- docs/docs/20-usage/50-environment.md | 2 +- docs/docs/20-usage/80-badges.md | 2 +- .../30-administration/10-server-config.md | 4 +- .../100-external-configuration-api.md | 4 +- docs/docs/30-administration/90-prometheus.md | 4 +- docs/docs/92-awesome.md | 16 ++--- docs/docs/92-development/03-ui.md | 2 +- docs/docs/92-development/06-guides.md | 2 +- docs/docs/92-development/08-swagger.md | 2 +- docs/docusaurus.config.js | 2 +- docs/plugins/woodpecker-plugins/plugins.json | 2 +- .../src/theme/WoodpeckerPluginList.tsx | 14 ++-- pipeline/frontend/yaml/compiler/cacher.go | 2 +- .../yaml/constraint/constraint_test.go | 64 +++++++++---------- .../frontend/yaml/types/container_test.go | 4 +- pipeline/samples/sample_1/pipeline.json | 8 +-- .../samples/sample_10_windows/pipeline.json | 12 ++-- pipeline/samples/sample_2/pipeline.json | 12 ++-- pipeline/samples/sample_3/pipeline.json | 12 ++-- pipeline/samples/sample_4/pipeline.json | 12 ++-- pipeline/samples/sample_5/pipeline.json | 24 +++---- pipeline/samples/sample_6/pipeline.json | 24 +++---- pipeline/samples/sample_9_cache/pipeline.json | 38 +++++------ .../.woodpecker/test-branches-array.yml | 2 +- .../test-branches-exclude-include.yml | 4 +- pipeline/schema/.woodpecker/test-branches.yml | 2 +- pipeline/schema/.woodpecker/test-broken.yml | 2 +- .../schema/.woodpecker/test-pipeline-when.yml | 8 +-- pipeline/schema/.woodpecker/test-when.yml | 22 +++---- pipeline/stepBuilder_test.go | 2 +- server/forge/bitbucket/convert_test.go | 10 +-- server/forge/bitbucket/fixtures/hooks.go | 18 +++--- server/forge/gitea/fixtures/hooks.go | 14 ++-- server/forge/gitea/helper_test.go | 16 ++--- server/forge/github/convert_test.go | 22 +++---- server/forge/github/fixtures/hooks.go | 16 ++--- server/forge/gitlab/gitlab_test.go | 2 +- server/forge/gitlab/testdata/hooks.go | 2 +- server/forge/gitlab/testdata/projects.go | 10 +-- server/store/datastore/pipeline_test.go | 12 ++-- 48 files changed, 235 insertions(+), 270 deletions(-) delete mode 100644 .github/ISSUE_TEMPLATE/plugin_index.yml.disabled diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index 2df4df3d67..90c9e4a821 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -56,9 +56,9 @@ body: label: Validations description: Before submitting the issue, please make sure you do the following options: - # - label: Follow our [Code of Conduct](https://github.com/woodpecker-ci/woodpecker/blob/master/CODE_OF_CONDUCT.md) + # - label: Follow our [Code of Conduct](https://github.com/woodpecker-ci/woodpecker/blob/main/CODE_OF_CONDUCT.md) # required: true - - label: Read the [Contributing Guidelines](https://github.com/woodpecker-ci/woodpecker/blob/master/CONTRIBUTING.md). + - label: Read the [Contributing Guidelines](https://github.com/woodpecker-ci/woodpecker/blob/main/CONTRIBUTING.md). required: true - label: Read the [docs](https://woodpecker-ci.org/docs/intro). required: true diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml index b6857757f2..212c4c1239 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.yml +++ b/.github/ISSUE_TEMPLATE/feature_request.yml @@ -37,11 +37,11 @@ body: label: Validations description: Before submitting the issue, please make sure you do the following options: - # - label: Follow our [Code of Conduct](https://github.com/woodpecker-ci/woodpecker/blob/master/CODE_OF_CONDUCT.md) + # - label: Follow our [Code of Conduct](https://github.com/woodpecker-ci/woodpecker/blob/main/CODE_OF_CONDUCT.md) # required: true - label: Checked that the feature isn't part of the `next` version already [https://woodpecker-ci.org/faq#which-version-of-woodpecker-should-i-use] required: true - - label: Read the [Contributing Guidelines](https://github.com/woodpecker-ci/woodpecker/blob/master/CONTRIBUTING.md). + - label: Read the [Contributing Guidelines](https://github.com/woodpecker-ci/woodpecker/blob/main/CONTRIBUTING.md). required: true - label: Read the [docs](https://woodpecker-ci.org/docs/intro). required: true diff --git a/.github/ISSUE_TEMPLATE/plugin_index.yml.disabled b/.github/ISSUE_TEMPLATE/plugin_index.yml.disabled deleted file mode 100644 index b0806c0f70..0000000000 --- a/.github/ISSUE_TEMPLATE/plugin_index.yml.disabled +++ /dev/null @@ -1,37 +0,0 @@ -name: "\U0001F4E6 Add plugin to official index" -description: Add your plugin to the official index at https://woodpecker-ci.org/plugins -labels: ["plugin"] -body: - - type: markdown - attributes: - value: | - Thanks for taking the time to fill out this request! - After successfully applying we will create a repository with the name `woodpecker-ci/plugin-` and grant - you write access to it. You will be able to manage things as wanted, just the main branch will be protected and needs approval - by a maintainer for security reasons. - - type: input - id: plugin-name - attributes: - label: Plugin name - validations: - required: true - - type: textarea - id: plugin-description - attributes: - label: Short description of the plugin - description: A short the description about the plugin. - placeholder: Plugin description - validations: - required: true - - type: checkboxes - id: checkboxes - attributes: - label: Validations - description: Before submitting the request, please make sure you do the following - options: - # - label: Follow our [Code of Conduct](https://github.com/woodpecker-ci/woodpecker/blob/master/CODE_OF_CONDUCT.md) - # required: true - - label: Read the [Contributing Guidelines](https://github.com/woodpecker-ci/woodpecker/blob/master/CONTRIBUTING.md). - required: true - - label: All plugin code must be licensed under a [FOSS license](https://opensource.org/licenses) - required: true diff --git a/README.md b/README.md index fbe6d4224e..d773d607c2 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ - + Translation status diff --git a/cli/deploy/deploy.go b/cli/deploy/deploy.go index 1aebc47e8e..109b81ecec 100644 --- a/cli/deploy/deploy.go +++ b/cli/deploy/deploy.go @@ -38,7 +38,7 @@ var Command = &cli.Command{ &cli.StringFlag{ Name: "branch", Usage: "branch filter", - Value: "master", + Value: "main", }, &cli.StringFlag{ Name: "event", diff --git a/cli/pipeline/last.go b/cli/pipeline/last.go index 7f84fd0b5c..55a9db99b1 100644 --- a/cli/pipeline/last.go +++ b/cli/pipeline/last.go @@ -34,7 +34,7 @@ var pipelineLastCmd = &cli.Command{ &cli.StringFlag{ Name: "branch", Usage: "branch name", - Value: "master", + Value: "main", }, ), } diff --git a/docs/README.md b/docs/README.md index f1e34b2c3a..822be20193 100644 --- a/docs/README.md +++ b/docs/README.md @@ -31,5 +31,5 @@ Deployment happen via [CI](https://github.com/woodpecker-ci/woodpecker/blob/d59f To manually build the website and push it exec: ```sh -GIT_USER=woodpecker-bot USE_SSH=true DEPLOYMENT_BRANCH=master pnpm deploy +GIT_USER=woodpecker-bot USE_SSH=true DEPLOYMENT_BRANCH=main pnpm deploy ``` diff --git a/docs/docs/20-usage/20-pipeline-syntax.md b/docs/docs/20-usage/20-pipeline-syntax.md index f87136164a..e334a45148 100644 --- a/docs/docs/20-usage/20-pipeline-syntax.md +++ b/docs/docs/20-usage/20-pipeline-syntax.md @@ -266,16 +266,16 @@ steps: settings: channel: dev + when: -+ - branch: master ++ - branch: main ``` -> The step now triggers on master, but also if the target branch of a pull request is `master`. Add an event condition to limit it further to pushes on master only. +> The step now triggers on main branch, but also if the target branch of a pull request is `main`. Add an event condition to limit it further to pushes on main only. -Execute a step if the branch is `master` or `develop`: +Execute a step if the branch is `main` or `develop`: ```yaml when: - - branch: [master, develop] + - branch: [main, develop] ``` Execute a step if the branch starts with `prefix/*`: @@ -297,7 +297,7 @@ Execute a step using custom include and exclude logic: ```yaml when: - branch: - include: [ master, release/* ] + include: [ main, release/* ] exclude: [ release/1.0.0, release/1.1.* ] ``` @@ -765,7 +765,7 @@ Example conditional execution by branch: ```diff +when: -+ branch: master ++ branch: main + steps: slack: @@ -774,13 +774,13 @@ Example conditional execution by branch: channel: dev ``` -> The step now triggers on master, but also if the target branch of a pull request is `master`. Add an event condition to limit it further to pushes on master only. +> The step now triggers on main, but also if the target branch of a pull request is `main`. Add an event condition to limit it further to pushes on main only. -Execute a step if the branch is `master` or `develop`: +Execute a step if the branch is `main` or `develop`: ```diff when: - branch: [master, develop] + branch: [main, develop] ``` Execute a step if the branch starts with `prefix/*`: @@ -795,7 +795,7 @@ Execute a step using custom include and exclude logic: ```diff when: branch: - include: [ master, release/* ] + include: [ main, release/* ] exclude: [ release/1.0.0, release/1.1.* ] ``` diff --git a/docs/docs/20-usage/50-environment.md b/docs/docs/20-usage/50-environment.md index fd3100782e..a6066166fe 100644 --- a/docs/docs/20-usage/50-environment.md +++ b/docs/docs/20-usage/50-environment.md @@ -57,7 +57,7 @@ This is the reference list of all environment variables available to your pipeli | `CI_REPO_SCM` | repository SCM (git) | | `CI_REPO_URL` | repository web URL | | `CI_REPO_CLONE_URL` | repository clone URL | -| `CI_REPO_DEFAULT_BRANCH` | repository default branch (master) | +| `CI_REPO_DEFAULT_BRANCH` | repository default branch (main) | | `CI_REPO_PRIVATE` | repository is private | | `CI_REPO_TRUSTED` | repository is trusted | | | **Current Commit** | diff --git a/docs/docs/20-usage/80-badges.md b/docs/docs/20-usage/80-badges.md index 87ded52504..1edfcfd495 100644 --- a/docs/docs/20-usage/80-badges.md +++ b/docs/docs/20-usage/80-badges.md @@ -8,7 +8,7 @@ Woodpecker has integrated support for repository status badges. These badges can :///api/badges//status.svg ``` -The status badge displays the status for the latest build to your default branch (e.g. master). You can customize the branch by adding the `branch` query parameter. +The status badge displays the status for the latest build to your default branch (e.g. main). You can customize the branch by adding the `branch` query parameter. ```diff -:///api/badges//status.svg diff --git a/docs/docs/30-administration/10-server-config.md b/docs/docs/30-administration/10-server-config.md index 0fff928b55..519419efa6 100644 --- a/docs/docs/30-administration/10-server-config.md +++ b/docs/docs/30-administration/10-server-config.md @@ -337,7 +337,7 @@ Always use authentication to clone repositories even if they are public. Needed List of event names that will be canceled when a new pipeline for the same context (tag, branch) is created. ### `WOODPECKER_DEFAULT_CLONE_IMAGE` -> Default is defined in [shared/constant/constant.go](https://github.com/woodpecker-ci/woodpecker/blob/master/shared/constant/constant.go) +> Default is defined in [shared/constant/constant.go](https://github.com/woodpecker-ci/woodpecker/blob/main/shared/constant/constant.go) The default docker image to be used when cloning the repo @@ -357,7 +357,7 @@ The maximum time in minutes you can set in the repo settings before a pipeline g Configures the session expiration time. ### `WOODPECKER_ESCALATE` -> Defaults are defined in [shared/constant/constant.go](https://github.com/woodpecker-ci/woodpecker/blob/master/shared/constant/constant.go) +> Defaults are defined in [shared/constant/constant.go](https://github.com/woodpecker-ci/woodpecker/blob/main/shared/constant/constant.go) Docker images to run in privileged mode. Only change if you are sure what you do! diff --git a/docs/docs/30-administration/100-external-configuration-api.md b/docs/docs/30-administration/100-external-configuration-api.md index 42851a4116..ab5823f3c0 100644 --- a/docs/docs/30-administration/100-external-configuration-api.md +++ b/docs/docs/30-administration/100-external-configuration-api.md @@ -51,7 +51,7 @@ WOODPECKER_CONFIG_SERVICE_ENDPOINT=https://example.com/ciconfig "author": "myUser", "author_avatar": "https://myforge.com/avatars/d6b3f7787a685fcdf2a44e2c685c7e03", "author_email": "my@email.com", - "branch": "master", + "branch": "main", "changed_files": [ "somefilename.txt" ], @@ -67,7 +67,7 @@ WOODPECKER_CONFIG_SERVICE_ENDPOINT=https://example.com/ciconfig "message": "test old config\n", "number": 0, "parent": 0, - "ref": "refs/heads/master", + "ref": "refs/heads/main", "refspec": "", "clone_url": "", "reviewed_at": 0, diff --git a/docs/docs/30-administration/90-prometheus.md b/docs/docs/30-administration/90-prometheus.md index 78e0093517..75702dc8d0 100644 --- a/docs/docs/30-administration/90-prometheus.md +++ b/docs/docs/30-administration/90-prometheus.md @@ -41,11 +41,11 @@ List of Prometheus metrics specific to Woodpecker: ``` # HELP woodpecker_pipeline_count Pipeline count. # TYPE woodpecker_pipeline_count counter -woodpecker_build_count{branch="master",pipeline="total",repo="woodpecker-ci/woodpecker",status="success"} 3 +woodpecker_build_count{branch="main",pipeline="total",repo="woodpecker-ci/woodpecker",status="success"} 3 woodpecker_build_count{branch="mkdocs",pipeline="total",repo="woodpecker-ci/woodpecker",status="success"} 3 # HELP woodpecker_pipeline_time Build time. # TYPE woodpecker_pipeline_time gauge -woodpecker_build_time{branch="master",pipeline="total",repo="woodpecker-ci/woodpecker",status="success"} 116 +woodpecker_build_time{branch="main",pipeline="total",repo="woodpecker-ci/woodpecker",status="success"} 116 woodpecker_build_time{branch="mkdocs",pipeline="total",repo="woodpecker-ci/woodpecker",status="success"} 155 # HELP woodpecker_pipeline_total_count Total number of builds. # TYPE woodpecker_pipeline_total_count gauge diff --git a/docs/docs/92-awesome.md b/docs/docs/92-awesome.md index e1fd8ce270..17f55ab7ee 100644 --- a/docs/docs/92-awesome.md +++ b/docs/docs/92-awesome.md @@ -2,20 +2,20 @@ A curated list of awesome things related to Woodpecker-CI. -If you have some missing resources, please feel free to [open a pull-request](https://github.com/woodpecker-ci/woodpecker/edit/master/docs/docs/92-awesome.md) and add them. +If you have some missing resources, please feel free to [open a pull-request](https://github.com/woodpecker-ci/woodpecker/edit/main/docs/docs/92-awesome.md) and add them. ## Official Resources -- [Woodpecker CI pipeline configs](https://github.com/woodpecker-ci/woodpecker/tree/master/.woodpecker) - Complex setup containing different kind of pipelines - - [Golang tests](https://github.com/woodpecker-ci/woodpecker/blob/master/.woodpecker/test.yml) - - [Typescript, eslint & Vue](https://github.com/woodpecker-ci/woodpecker/blob/master/.woodpecker/web.yml) - - [Docusaurus & publishing to GitHub Pages](https://github.com/woodpecker-ci/woodpecker/blob/master/.woodpecker/docs.yml) - - [Docker container building](https://github.com/woodpecker-ci/woodpecker/blob/master/.woodpecker/docker.yml) - - [Helm chart linting & releasing](https://github.com/woodpecker-ci/woodpecker/blob/master/.woodpecker/helm.yml) +- [Woodpecker CI pipeline configs](https://github.com/woodpecker-ci/woodpecker/tree/main/.woodpecker) - Complex setup containing different kind of pipelines + - [Golang tests](https://github.com/woodpecker-ci/woodpecker/blob/main/.woodpecker/test.yml) + - [Typescript, eslint & Vue](https://github.com/woodpecker-ci/woodpecker/blob/main/.woodpecker/web.yml) + - [Docusaurus & publishing to GitHub Pages](https://github.com/woodpecker-ci/woodpecker/blob/main/.woodpecker/docs.yml) + - [Docker container building](https://github.com/woodpecker-ci/woodpecker/blob/main/.woodpecker/docker.yml) + - [Helm chart linting & releasing](https://github.com/woodpecker-ci/woodpecker/blob/main/.woodpecker/helm.yml) ## Projects using Woodpecker -- [Woodpecker-CI](https://github.com/woodpecker-ci/woodpecker/tree/master/.woodpecker) itself +- [Woodpecker-CI](https://github.com/woodpecker-ci/woodpecker/tree/main/.woodpecker) itself - [All official plugins](https://github.com/woodpecker-ci?q=plugin&type=all) - [dessalines/thumb-key](https://github.com/dessalines/thumb-key/blob/main/.woodpecker.yml) - Android Jetpack compose linting and building diff --git a/docs/docs/92-development/03-ui.md b/docs/docs/92-development/03-ui.md index b2a1248472..fb00da457c 100644 --- a/docs/docs/92-development/03-ui.md +++ b/docs/docs/92-development/03-ui.md @@ -33,6 +33,6 @@ The following list contains some tools and frameworks used by the Woodpecker UI. ## Messages and Translations Woodpecker uses [Vue I18n](https://vue-i18n.intlify.dev/) as translation library. New translations have to be added to `web/src/assets/locales/en.json`. The English source file will be automatically imported into [Weblate](https://translate.woodpecker-ci.org/) (the translation system used by Woodpecker) where all other languages will be translated by the community based on the English source. -You must not provide translations except English in PRs, otherwise weblate could put git into conflicts (when someone has translated in that language file and changes are not into master branch yet) +You must not provide translations except English in PRs, otherwise weblate could put git into conflicts (when someone has translated in that language file and changes are not into main branch yet) For more information about translations see [Translations](./07-translations.md). diff --git a/docs/docs/92-development/06-guides.md b/docs/docs/92-development/06-guides.md index 3752cd2ad7..88d6c2dbd2 100644 --- a/docs/docs/92-development/06-guides.md +++ b/docs/docs/92-development/06-guides.md @@ -36,4 +36,4 @@ To automatically execute the migration after the start of the server, the new mi ## Constants of official images -All official default images, are saved in [shared/constant/constant.go](https://github.com/woodpecker-ci/woodpecker/blob/master/shared/constant/constant.go) and must be pinned by an exact tag. +All official default images, are saved in [shared/constant/constant.go](https://github.com/woodpecker-ci/woodpecker/blob/main/shared/constant/constant.go) and must be pinned by an exact tag. diff --git a/docs/docs/92-development/08-swagger.md b/docs/docs/92-development/08-swagger.md index 6d8d99f6fb..fc33f72329 100644 --- a/docs/docs/92-development/08-swagger.md +++ b/docs/docs/92-development/08-swagger.md @@ -47,7 +47,7 @@ These guidelines aim to have consistent wording in the swagger doc: * `@Param Authorization` is almost always present, there are just a few un-protected endpoints There are many examples in the server/api package, which you can use a blueprint. -More enhanced information you can find here https://github.com/swaggo/swag/blob/master/README.md#declarative-comments-format +More enhanced information you can find here https://github.com/swaggo/swag/blob/main/README.md#declarative-comments-format ### Manual code generation diff --git a/docs/docusaurus.config.js b/docs/docusaurus.config.js index e9f60822d6..fa377f314a 100644 --- a/docs/docusaurus.config.js +++ b/docs/docusaurus.config.js @@ -210,7 +210,7 @@ module.exports = { ({ docs: { sidebarPath: require.resolve('./sidebars.js'), - editUrl: 'https://github.com/woodpecker-ci/woodpecker/edit/master/docs/', + editUrl: 'https://github.com/woodpecker-ci/woodpecker/edit/main/docs/', includeCurrentVersion: true, lastVersion: '1.0', versions: { diff --git a/docs/plugins/woodpecker-plugins/plugins.json b/docs/plugins/woodpecker-plugins/plugins.json index f1cab6cdc7..f4d07e8630 100644 --- a/docs/plugins/woodpecker-plugins/plugins.json +++ b/docs/plugins/woodpecker-plugins/plugins.json @@ -2,7 +2,7 @@ "plugins": [ { "name": "Clone plugin", - "docs": "https://raw.githubusercontent.com/woodpecker-ci/plugin-git/master/docs.md", + "docs": "https://raw.githubusercontent.com/woodpecker-ci/plugin-git/main/docs.md", "verified": true }, { diff --git a/docs/plugins/woodpecker-plugins/src/theme/WoodpeckerPluginList.tsx b/docs/plugins/woodpecker-plugins/src/theme/WoodpeckerPluginList.tsx index 8b6df26003..403dce9841 100644 --- a/docs/plugins/woodpecker-plugins/src/theme/WoodpeckerPluginList.tsx +++ b/docs/plugins/woodpecker-plugins/src/theme/WoodpeckerPluginList.tsx @@ -33,16 +33,18 @@ function PluginPanel({ plugin }: { plugin: WoodpeckerPlugin }) { export function WoodpeckerPluginList({ plugins }: { plugins: WoodpeckerPlugin[] }) { const applyForIndexUrl = - 'https://github.com/woodpecker-ci/woodpecker/edit/master/docs/plugins/woodpecker-plugins/plugins.json'; + 'https://github.com/woodpecker-ci/woodpecker/edit/main/docs/plugins/woodpecker-plugins/plugins.json'; const [query, setQuery] = useState(''); - const fuse = useRef(new Fuse(plugins, { - keys: ['name', 'description'], - threshold: 0.3, - })); + const fuse = useRef( + new Fuse(plugins, { + keys: ['name', 'description'], + threshold: 0.3, + }), + ); - const searchedPlugins = query.length >= 1 ? fuse.current.search(query).map((p) => ( p.item )) : plugins; + const searchedPlugins = query.length >= 1 ? fuse.current.search(query).map((p) => p.item) : plugins; return ( diff --git a/pipeline/frontend/yaml/compiler/cacher.go b/pipeline/frontend/yaml/compiler/cacher.go index bb8f1201be..02fe907d0e 100644 --- a/pipeline/frontend/yaml/compiler/cacher.go +++ b/pipeline/frontend/yaml/compiler/cacher.go @@ -27,7 +27,7 @@ func (c *volumeCacher) Restore(repo, branch string, mounts []string) *yaml_types "path": "/cache", "restore": true, "file": strings.Replace(branch, "/", "_", -1) + ".tar", - "fallback_to": "master.tar", + "fallback_to": "main.tar", }, Volumes: yaml_types.Volumes{ Volumes: []*yaml_types.Volume{ diff --git a/pipeline/frontend/yaml/constraint/constraint_test.go b/pipeline/frontend/yaml/constraint/constraint_test.go index 3643ef9a13..3fb3bc9cdb 100644 --- a/pipeline/frontend/yaml/constraint/constraint_test.go +++ b/pipeline/frontend/yaml/constraint/constraint_test.go @@ -18,13 +18,13 @@ func TestConstraint(t *testing.T) { }{ // string value { - conf: "master", + conf: "main", with: "develop", want: false, }, { - conf: "master", - with: "master", + conf: "main", + with: "main", want: true, }, { @@ -34,34 +34,34 @@ func TestConstraint(t *testing.T) { }, // slice value { - conf: "[ master, feature/* ]", + conf: "[ main, feature/* ]", with: "develop", want: false, }, { - conf: "[ master, feature/* ]", - with: "master", + conf: "[ main, feature/* ]", + with: "main", want: true, }, { - conf: "[ master, feature/* ]", + conf: "[ main, feature/* ]", with: "feature/foo", want: true, }, // includes block { - conf: "include: master", + conf: "include: main", with: "develop", want: false, }, { - conf: "include: master", - with: "master", + conf: "include: main", + with: "main", want: true, }, { conf: "include: feature/*", - with: "master", + with: "main", want: false, }, { @@ -70,34 +70,34 @@ func TestConstraint(t *testing.T) { want: true, }, { - conf: "include: [ master, feature/* ]", + conf: "include: [ main, feature/* ]", with: "develop", want: false, }, { - conf: "include: [ master, feature/* ]", - with: "master", + conf: "include: [ main, feature/* ]", + with: "main", want: true, }, { - conf: "include: [ master, feature/* ]", + conf: "include: [ main, feature/* ]", with: "feature/foo", want: true, }, // excludes block { - conf: "exclude: master", + conf: "exclude: main", with: "develop", want: true, }, { - conf: "exclude: master", - with: "master", + conf: "exclude: main", + with: "main", want: false, }, { conf: "exclude: feature/*", - with: "master", + with: "main", want: true, }, { @@ -106,13 +106,13 @@ func TestConstraint(t *testing.T) { want: false, }, { - conf: "exclude: [ master, develop ]", - with: "master", + conf: "exclude: [ main, develop ]", + with: "main", want: false, }, { conf: "exclude: [ feature/*, bar ]", - with: "master", + with: "main", want: true, }, { @@ -122,24 +122,24 @@ func TestConstraint(t *testing.T) { }, // include and exclude blocks { - conf: "{ include: [ master, feature/* ], exclude: [ develop ] }", - with: "master", + conf: "{ include: [ main, feature/* ], exclude: [ develop ] }", + with: "main", want: true, }, { - conf: "{ include: [ master, feature/* ], exclude: [ feature/bar ] }", + conf: "{ include: [ main, feature/* ], exclude: [ feature/bar ] }", with: "feature/bar", want: false, }, { - conf: "{ include: [ master, feature/* ], exclude: [ master, develop ] }", - with: "master", + conf: "{ include: [ main, feature/* ], exclude: [ main, develop ] }", + with: "main", want: false, }, // empty blocks { conf: "", - with: "master", + with: "main", want: true, }, } @@ -421,13 +421,13 @@ func TestConstraints(t *testing.T) { { desc: "global branch filter", conf: "{ branch: develop }", - with: metadata.Metadata{Curr: metadata.Pipeline{Event: metadata.EventPush, Commit: metadata.Commit{Branch: "master"}}}, + with: metadata.Metadata{Curr: metadata.Pipeline{Event: metadata.EventPush, Commit: metadata.Commit{Branch: "main"}}}, want: false, }, { desc: "global branch filter", - conf: "{ branch: master }", - with: metadata.Metadata{Curr: metadata.Pipeline{Event: metadata.EventPush, Commit: metadata.Commit{Branch: "master"}}}, + conf: "{ branch: main }", + with: metadata.Metadata{Curr: metadata.Pipeline{Event: metadata.EventPush, Commit: metadata.Commit{Branch: "main"}}}, want: true, }, { @@ -451,7 +451,7 @@ func TestConstraints(t *testing.T) { { desc: "ref constraint", conf: "{ ref: refs/tags/* }", - with: metadata.Metadata{Curr: metadata.Pipeline{Commit: metadata.Commit{Ref: "refs/heads/master"}, Event: metadata.EventPush}}, + with: metadata.Metadata{Curr: metadata.Pipeline{Commit: metadata.Commit{Ref: "refs/heads/main"}, Event: metadata.EventPush}}, want: false, }, { diff --git a/pipeline/frontend/yaml/types/container_test.go b/pipeline/frontend/yaml/types/container_test.go index b3755a9852..287a10e63e 100644 --- a/pipeline/frontend/yaml/types/container_test.go +++ b/pipeline/frontend/yaml/types/container_test.go @@ -48,7 +48,7 @@ volumes: tmpfs: - /var/lib/test when: - - branch: master + - branch: main - event: cron cron: job1 settings: @@ -95,7 +95,7 @@ func TestUnmarshalContainer(t *testing.T) { Constraints: []constraint.Constraint{ { Branch: constraint.List{ - Include: []string{"master"}, + Include: []string{"main"}, }, }, { diff --git a/pipeline/samples/sample_1/pipeline.json b/pipeline/samples/sample_1/pipeline.json index 568c0a7d6e..1d0c9ed3e4 100644 --- a/pipeline/samples/sample_1/pipeline.json +++ b/pipeline/samples/sample_1/pipeline.json @@ -16,9 +16,9 @@ "CI_PIPELINE_NUMBER": "6", "CI_PIPELINE_STARTED": "1486119585", "CI_COMMIT_AUTHOR": "bradrydzewski", - "CI_COMMIT_BRANCH": "master", + "CI_COMMIT_BRANCH": "main", "CI_COMMIT_MESSAGE": "added a few more test cases for escaping behavior", - "CI_COMMIT_REF": "refs/heads/master", + "CI_COMMIT_REF": "refs/heads/main", "CI_COMMIT_SHA": "d0876d3176965f9552a611cbd56e24a9264355e6", "CI_REMOTE_URL": "https://github.com/drone/envsubst.git", "CI_REPO": "drone/envsubst", @@ -60,9 +60,9 @@ "CI_PIPELINE_NUMBER": "6", "CI_PIPELINE_STARTED": "1486119585", "CI_COMMIT_AUTHOR": "bradrydzewski", - "CI_COMMIT_BRANCH": "master", + "CI_COMMIT_BRANCH": "main", "CI_COMMIT_MESSAGE": "added a few more test cases for escaping behavior", - "CI_COMMIT_REF": "refs/heads/master", + "CI_COMMIT_REF": "refs/heads/main", "CI_COMMIT_SHA": "d0876d3176965f9552a611cbd56e24a9264355e6", "CI_REMOTE_URL": "https://github.com/drone/envsubst.git", "CI_REPO": "drone/envsubst", diff --git a/pipeline/samples/sample_10_windows/pipeline.json b/pipeline/samples/sample_10_windows/pipeline.json index 9188aff36f..b8eb0d8f3b 100644 --- a/pipeline/samples/sample_10_windows/pipeline.json +++ b/pipeline/samples/sample_10_windows/pipeline.json @@ -16,9 +16,9 @@ "CI_PIPELINE_NUMBER": "6", "CI_PIPELINE_STARTED": "1486119585", "CI_COMMIT_AUTHOR": "bradrydzewski", - "CI_COMMIT_BRANCH": "master", + "CI_COMMIT_BRANCH": "main", "CI_COMMIT_MESSAGE": "added a few more test cases for escaping behavior", - "CI_COMMIT_REF": "refs/heads/master", + "CI_COMMIT_REF": "refs/heads/main", "CI_COMMIT_SHA": "d0876d3176965f9552a611cbd56e24a9264355e6", "CI_REMOTE_URL": "https://github.com/drone/envsubst.git", "CI_REPO": "drone/envsubst", @@ -31,7 +31,7 @@ "CI_SYSTEM_NAME": "pipec", "CI_WORKSPACE": "c:\\gopath/src\\github.com\\drone\\envsubst", "CI_ARCH": "windows/amd64", - "CI_BRANCH": "master", + "CI_BRANCH": "main", "CI_PIPELINE_URL": "https://github.com/cncd/pipec/drone/envsubst/6", "CI_COMMIT": "d0876d3176965f9552a611cbd56e24a9264355e6", "CI_STEP_STARTED": "1486119585", @@ -67,9 +67,9 @@ "CI_PIPELINE_NUMBER": "6", "CI_PIPELINE_STARTED": "1486119585", "CI_COMMIT_AUTHOR": "bradrydzewski", - "CI_COMMIT_BRANCH": "master", + "CI_COMMIT_BRANCH": "main", "CI_COMMIT_MESSAGE": "added a few more test cases for escaping behavior", - "CI_COMMIT_REF": "refs/heads/master", + "CI_COMMIT_REF": "refs/heads/main", "CI_COMMIT_SHA": "d0876d3176965f9552a611cbd56e24a9264355e6", "CI_REMOTE_URL": "https://github.com/drone/envsubst.git", "CI_REPO": "drone/envsubst", @@ -83,7 +83,7 @@ "CI_SYSTEM_NAME": "pipec", "CI_WORKSPACE": "c:\\gopath/src\\github.com\\drone\\envsubst", "CI_ARCH": "windows/amd64", - "CI_BRANCH": "master", + "CI_BRANCH": "main", "CI_PIPELINE_URL": "https://github.com/cncd/pipec/drone/envsubst/6", "CI_COMMIT": "d0876d3176965f9552a611cbd56e24a9264355e6", "CI_STEP_STARTED": "1486119585", diff --git a/pipeline/samples/sample_2/pipeline.json b/pipeline/samples/sample_2/pipeline.json index 1c71be61d1..24fc4fa8d4 100644 --- a/pipeline/samples/sample_2/pipeline.json +++ b/pipeline/samples/sample_2/pipeline.json @@ -15,9 +15,9 @@ "CI_PIPELINE_NUMBER": "530", "CI_PIPELINE_STARTED": "1486119585", "CI_COMMIT_AUTHOR": "egorsmkv", - "CI_COMMIT_BRANCH": "master", + "CI_COMMIT_BRANCH": "main", "CI_COMMIT_MESSAGE": "Fix many urls", - "CI_COMMIT_REF": "refs/heads/master", + "CI_COMMIT_REF": "refs/heads/main", "CI_COMMIT_SHA": "2e00b5cd70399450106cec6431c2e2ce3cae5034", "CI_REMOTE_URL": "https://github.com/go-sql-driver/mysql.git", "CI_REPO": "go-sql-driver/mysql", @@ -59,9 +59,9 @@ "CI_PIPELINE_NUMBER": "530", "CI_PIPELINE_STARTED": "1486119585", "CI_COMMIT_AUTHOR": "egorsmkv", - "CI_COMMIT_BRANCH": "master", + "CI_COMMIT_BRANCH": "main", "CI_COMMIT_MESSAGE": "Fix many urls", - "CI_COMMIT_REF": "refs/heads/master", + "CI_COMMIT_REF": "refs/heads/main", "CI_COMMIT_SHA": "2e00b5cd70399450106cec6431c2e2ce3cae5034", "CI_REMOTE_URL": "https://github.com/go-sql-driver/mysql.git", "CI_REPO": "go-sql-driver/mysql", @@ -104,9 +104,9 @@ "CI_PIPELINE_NUMBER": "530", "CI_PIPELINE_STARTED": "1486119585", "CI_COMMIT_AUTHOR": "egorsmkv", - "CI_COMMIT_BRANCH": "master", + "CI_COMMIT_BRANCH": "main", "CI_COMMIT_MESSAGE": "Fix many urls", - "CI_COMMIT_REF": "refs/heads/master", + "CI_COMMIT_REF": "refs/heads/main", "CI_COMMIT_SHA": "2e00b5cd70399450106cec6431c2e2ce3cae5034", "CI_REMOTE_URL": "https://github.com/go-sql-driver/mysql.git", "CI_REPO": "go-sql-driver/mysql", diff --git a/pipeline/samples/sample_3/pipeline.json b/pipeline/samples/sample_3/pipeline.json index 58e648ca76..792924350f 100644 --- a/pipeline/samples/sample_3/pipeline.json +++ b/pipeline/samples/sample_3/pipeline.json @@ -16,9 +16,9 @@ "CI_PIPELINE_NUMBER": "6", "CI_PIPELINE_STARTED": "1486119585", "CI_COMMIT_AUTHOR": "bradrydzewski", - "CI_COMMIT_BRANCH": "master", + "CI_COMMIT_BRANCH": "main", "CI_COMMIT_MESSAGE": "added a few more test cases for escaping behavior", - "CI_COMMIT_REF": "refs/heads/master", + "CI_COMMIT_REF": "refs/heads/main", "CI_COMMIT_SHA": "d0876d3176965f9552a611cbd56e24a9264355e6", "CI_REMOTE_URL": "https://github.com/drone/envsubst.git", "CI_REPO": "drone/envsubst", @@ -60,9 +60,9 @@ "CI_PIPELINE_NUMBER": "6", "CI_PIPELINE_STARTED": "1486119585", "CI_COMMIT_AUTHOR": "bradrydzewski", - "CI_COMMIT_BRANCH": "master", + "CI_COMMIT_BRANCH": "main", "CI_COMMIT_MESSAGE": "added a few more test cases for escaping behavior", - "CI_COMMIT_REF": "refs/heads/master", + "CI_COMMIT_REF": "refs/heads/main", "CI_COMMIT_SHA": "d0876d3176965f9552a611cbd56e24a9264355e6", "CI_REMOTE_URL": "https://github.com/drone/envsubst.git", "CI_REPO": "drone/envsubst", @@ -108,9 +108,9 @@ "CI_PIPELINE_NUMBER": "6", "CI_PIPELINE_STARTED": "1486119585", "CI_COMMIT_AUTHOR": "bradrydzewski", - "CI_COMMIT_BRANCH": "master", + "CI_COMMIT_BRANCH": "main", "CI_COMMIT_MESSAGE": "added a few more test cases for escaping behavior", - "CI_COMMIT_REF": "refs/heads/master", + "CI_COMMIT_REF": "refs/heads/main", "CI_COMMIT_SHA": "d0876d3176965f9552a611cbd56e24a9264355e6", "CI_REMOTE_URL": "https://github.com/drone/envsubst.git", "CI_REPO": "drone/envsubst", diff --git a/pipeline/samples/sample_4/pipeline.json b/pipeline/samples/sample_4/pipeline.json index 05640e9586..8082624d75 100644 --- a/pipeline/samples/sample_4/pipeline.json +++ b/pipeline/samples/sample_4/pipeline.json @@ -16,9 +16,9 @@ "CI_PIPELINE_NUMBER": "6", "CI_PIPELINE_STARTED": "1486119585", "CI_COMMIT_AUTHOR": "bradrydzewski", - "CI_COMMIT_BRANCH": "master", + "CI_COMMIT_BRANCH": "main", "CI_COMMIT_MESSAGE": "added a few more test cases for escaping behavior", - "CI_COMMIT_REF": "refs/heads/master", + "CI_COMMIT_REF": "refs/heads/main", "CI_COMMIT_SHA": "d0876d3176965f9552a611cbd56e24a9264355e6", "CI_REMOTE_URL": "https://github.com/drone/envsubst.git", "CI_REPO": "drone/envsubst", @@ -60,9 +60,9 @@ "CI_PIPELINE_NUMBER": "6", "CI_PIPELINE_STARTED": "1486119585", "CI_COMMIT_AUTHOR": "bradrydzewski", - "CI_COMMIT_BRANCH": "master", + "CI_COMMIT_BRANCH": "main", "CI_COMMIT_MESSAGE": "added a few more test cases for escaping behavior", - "CI_COMMIT_REF": "refs/heads/master", + "CI_COMMIT_REF": "refs/heads/main", "CI_COMMIT_SHA": "d0876d3176965f9552a611cbd56e24a9264355e6", "CI_REMOTE_URL": "https://github.com/drone/envsubst.git", "CI_REPO": "drone/envsubst", @@ -108,9 +108,9 @@ "CI_PIPELINE_NUMBER": "6", "CI_PIPELINE_STARTED": "1486119585", "CI_COMMIT_AUTHOR": "bradrydzewski", - "CI_COMMIT_BRANCH": "master", + "CI_COMMIT_BRANCH": "main", "CI_COMMIT_MESSAGE": "added a few more test cases for escaping behavior", - "CI_COMMIT_REF": "refs/heads/master", + "CI_COMMIT_REF": "refs/heads/main", "CI_COMMIT_SHA": "d0876d3176965f9552a611cbd56e24a9264355e6", "CI_REMOTE_URL": "https://github.com/drone/envsubst.git", "CI_REPO": "drone/envsubst", diff --git a/pipeline/samples/sample_5/pipeline.json b/pipeline/samples/sample_5/pipeline.json index c720ef268f..f5af6c8490 100644 --- a/pipeline/samples/sample_5/pipeline.json +++ b/pipeline/samples/sample_5/pipeline.json @@ -16,9 +16,9 @@ "CI_PIPELINE_NUMBER": "6", "CI_PIPELINE_STARTED": "1486119585", "CI_COMMIT_AUTHOR": "bradrydzewski", - "CI_COMMIT_BRANCH": "master", + "CI_COMMIT_BRANCH": "main", "CI_COMMIT_MESSAGE": "added a few more test cases for escaping behavior", - "CI_COMMIT_REF": "refs/heads/master", + "CI_COMMIT_REF": "refs/heads/main", "CI_COMMIT_SHA": "d0876d3176965f9552a611cbd56e24a9264355e6", "CI_REMOTE_URL": "https://github.com/drone/envsubst.git", "CI_REPO": "drone/envsubst", @@ -60,9 +60,9 @@ "CI_PIPELINE_NUMBER": "6", "CI_PIPELINE_STARTED": "1486119585", "CI_COMMIT_AUTHOR": "bradrydzewski", - "CI_COMMIT_BRANCH": "master", + "CI_COMMIT_BRANCH": "main", "CI_COMMIT_MESSAGE": "added a few more test cases for escaping behavior", - "CI_COMMIT_REF": "refs/heads/master", + "CI_COMMIT_REF": "refs/heads/main", "CI_COMMIT_SHA": "d0876d3176965f9552a611cbd56e24a9264355e6", "CI_REMOTE_URL": "https://github.com/drone/envsubst.git", "CI_REPO": "drone/envsubst", @@ -102,9 +102,9 @@ "CI_PIPELINE_NUMBER": "6", "CI_PIPELINE_STARTED": "1486119585", "CI_COMMIT_AUTHOR": "bradrydzewski", - "CI_COMMIT_BRANCH": "master", + "CI_COMMIT_BRANCH": "main", "CI_COMMIT_MESSAGE": "added a few more test cases for escaping behavior", - "CI_COMMIT_REF": "refs/heads/master", + "CI_COMMIT_REF": "refs/heads/main", "CI_COMMIT_SHA": "d0876d3176965f9552a611cbd56e24a9264355e6", "CI_REMOTE_URL": "https://github.com/drone/envsubst.git", "CI_REPO": "drone/envsubst", @@ -150,9 +150,9 @@ "CI_PIPELINE_NUMBER": "6", "CI_PIPELINE_STARTED": "1486119585", "CI_COMMIT_AUTHOR": "bradrydzewski", - "CI_COMMIT_BRANCH": "master", + "CI_COMMIT_BRANCH": "main", "CI_COMMIT_MESSAGE": "added a few more test cases for escaping behavior", - "CI_COMMIT_REF": "refs/heads/master", + "CI_COMMIT_REF": "refs/heads/main", "CI_COMMIT_SHA": "d0876d3176965f9552a611cbd56e24a9264355e6", "CI_REMOTE_URL": "https://github.com/drone/envsubst.git", "CI_REPO": "drone/envsubst", @@ -198,9 +198,9 @@ "CI_PIPELINE_NUMBER": "6", "CI_PIPELINE_STARTED": "1486119585", "CI_COMMIT_AUTHOR": "bradrydzewski", - "CI_COMMIT_BRANCH": "master", + "CI_COMMIT_BRANCH": "main", "CI_COMMIT_MESSAGE": "added a few more test cases for escaping behavior", - "CI_COMMIT_REF": "refs/heads/master", + "CI_COMMIT_REF": "refs/heads/main", "CI_COMMIT_SHA": "d0876d3176965f9552a611cbd56e24a9264355e6", "CI_REMOTE_URL": "https://github.com/drone/envsubst.git", "CI_REPO": "drone/envsubst", @@ -240,9 +240,9 @@ "CI_PIPELINE_NUMBER": "6", "CI_PIPELINE_STARTED": "1486119585", "CI_COMMIT_AUTHOR": "bradrydzewski", - "CI_COMMIT_BRANCH": "master", + "CI_COMMIT_BRANCH": "main", "CI_COMMIT_MESSAGE": "added a few more test cases for escaping behavior", - "CI_COMMIT_REF": "refs/heads/master", + "CI_COMMIT_REF": "refs/heads/main", "CI_COMMIT_SHA": "d0876d3176965f9552a611cbd56e24a9264355e6", "CI_REMOTE_URL": "https://github.com/drone/envsubst.git", "CI_REPO": "drone/envsubst", diff --git a/pipeline/samples/sample_6/pipeline.json b/pipeline/samples/sample_6/pipeline.json index 4fa9486020..30e98f6684 100644 --- a/pipeline/samples/sample_6/pipeline.json +++ b/pipeline/samples/sample_6/pipeline.json @@ -16,9 +16,9 @@ "CI_PIPELINE_NUMBER": "6", "CI_PIPELINE_STARTED": "1486119585", "CI_COMMIT_AUTHOR": "bradrydzewski", - "CI_COMMIT_BRANCH": "master", + "CI_COMMIT_BRANCH": "main", "CI_COMMIT_MESSAGE": "added a few more test cases for escaping behavior", - "CI_COMMIT_REF": "refs/heads/master", + "CI_COMMIT_REF": "refs/heads/main", "CI_COMMIT_SHA": "d0876d3176965f9552a611cbd56e24a9264355e6", "CI_REMOTE_URL": "https://github.com/drone/envsubst.git", "CI_REPO": "drone/envsubst", @@ -31,11 +31,11 @@ "CI_SYSTEM_NAME": "pipec", "CI_WORKSPACE": "/go/src/github.com/drone/envsubst", "CI_ARCH": "linux/amd64", - "CI_BRANCH": "master", + "CI_BRANCH": "main", "CI_PIPELINE_URL": "https://github.com/cncd/pipec/drone/envsubst/6", "CI_COMMIT": "d0876d3176965f9552a611cbd56e24a9264355e6", "CI_STEP_STARTED": "1486119585", - "CI_REPO_BRANCH": "master", + "CI_REPO_BRANCH": "main", "CI_REPO_OWNER": "drone", "CI_REPO_SCM": "git", "PLUGIN_DEPTH": "50" @@ -71,9 +71,9 @@ "CI_PIPELINE_NUMBER": "6", "CI_PIPELINE_STARTED": "1486119585", "CI_COMMIT_AUTHOR": "bradrydzewski", - "CI_COMMIT_BRANCH": "master", + "CI_COMMIT_BRANCH": "main", "CI_COMMIT_MESSAGE": "added a few more test cases for escaping behavior", - "CI_COMMIT_REF": "refs/heads/master", + "CI_COMMIT_REF": "refs/heads/main", "CI_COMMIT_SHA": "d0876d3176965f9552a611cbd56e24a9264355e6", "CI_REMOTE_URL": "https://github.com/drone/envsubst.git", "CI_REPO": "drone/envsubst", @@ -87,10 +87,10 @@ "CI_SYSTEM_NAME": "pipec", "CI_WORKSPACE": "/go/src/github.com/drone/envsubst", "CI_ARCH": "linux/amd64", - "CI_BRANCH": "master", + "CI_BRANCH": "main", "CI_COMMIT": "d0876d3176965f9552a611cbd56e24a9264355e6", "CI_STEP_STARTED": "1486119585", - "CI_REPO_BRANCH": "master", + "CI_REPO_BRANCH": "main", "CI_REPO_OWNER": "drone", "CI_REPO_SCM": "git", "HOME": "/root", @@ -129,9 +129,9 @@ "CI_PIPELINE_NUMBER": "6", "CI_PIPELINE_STARTED": "1486119585", "CI_COMMIT_AUTHOR": "bradrydzewski", - "CI_COMMIT_BRANCH": "master", + "CI_COMMIT_BRANCH": "main", "CI_COMMIT_MESSAGE": "added a few more test cases for escaping behavior", - "CI_COMMIT_REF": "refs/heads/master", + "CI_COMMIT_REF": "refs/heads/main", "CI_COMMIT_SHA": "d0876d3176965f9552a611cbd56e24a9264355e6", "CI_REMOTE_URL": "https://github.com/drone/envsubst.git", "CI_REPO": "drone/envsubst", @@ -144,11 +144,11 @@ "CI_SYSTEM_NAME": "pipec", "CI_WORKSPACE": "/go/src/github.com/drone/envsubst", "CI_ARCH": "linux/amd64", - "CI_BRANCH": "master", + "CI_BRANCH": "main", "CI_PIPELINE_URL": "https://github.com/cncd/pipec/drone/envsubst/6", "CI_COMMIT": "d0876d3176965f9552a611cbd56e24a9264355e6", "CI_STEP_STARTED": "1486119585", - "CI_REPO_BRANCH": "master", + "CI_REPO_BRANCH": "main", "CI_REPO_OWNER": "drone", "CI_REPO_SCM": "git", "PLUGIN_CHANNEL": "builds", diff --git a/pipeline/samples/sample_9_cache/pipeline.json b/pipeline/samples/sample_9_cache/pipeline.json index c14a845710..1d787f6fcf 100644 --- a/pipeline/samples/sample_9_cache/pipeline.json +++ b/pipeline/samples/sample_9_cache/pipeline.json @@ -16,9 +16,9 @@ "CI_PIPELINE_NUMBER": "6", "CI_PIPELINE_STARTED": "1486119585", "CI_COMMIT_AUTHOR": "bradrydzewski", - "CI_COMMIT_BRANCH": "master", + "CI_COMMIT_BRANCH": "main", "CI_COMMIT_MESSAGE": "added a few more test cases for escaping behavior", - "CI_COMMIT_REF": "refs/heads/master", + "CI_COMMIT_REF": "refs/heads/main", "CI_COMMIT_SHA": "d0876d3176965f9552a611cbd56e24a9264355e6", "CI_REMOTE_URL": "https://github.com/drone/envsubst.git", "CI_REPO": "drone/envsubst", @@ -31,11 +31,11 @@ "CI_SYSTEM_NAME": "pipec", "CI_WORKSPACE": "/pipeline/src", "CI_ARCH": "linux/amd64", - "CI_BRANCH": "master", + "CI_BRANCH": "main", "CI_PIPELINE_URL": "https://github.com/cncd/pipec/drone/envsubst/6", "CI_COMMIT": "d0876d3176965f9552a611cbd56e24a9264355e6", "CI_STEP_STARTED": "1486119585", - "CI_REPO_BRANCH": "master", + "CI_REPO_BRANCH": "main", "CI_REPO_OWNER": "drone", "CI_REPO_SCM": "git", "PLUGIN_DEPTH": "0" @@ -68,9 +68,9 @@ "CI_PIPELINE_NUMBER": "6", "CI_PIPELINE_STARTED": "1486119585", "CI_COMMIT_AUTHOR": "bradrydzewski", - "CI_COMMIT_BRANCH": "master", + "CI_COMMIT_BRANCH": "main", "CI_COMMIT_MESSAGE": "added a few more test cases for escaping behavior", - "CI_COMMIT_REF": "refs/heads/master", + "CI_COMMIT_REF": "refs/heads/main", "CI_COMMIT_SHA": "d0876d3176965f9552a611cbd56e24a9264355e6", "CI_REMOTE_URL": "https://github.com/drone/envsubst.git", "CI_REPO": "drone/envsubst", @@ -83,15 +83,15 @@ "CI_SYSTEM_NAME": "pipec", "CI_WORKSPACE": "/pipeline/src", "CI_ARCH": "linux/amd64", - "CI_BRANCH": "master", + "CI_BRANCH": "main", "CI_PIPELINE_URL": "https://github.com/cncd/pipec/drone/envsubst/6", "CI_COMMIT": "d0876d3176965f9552a611cbd56e24a9264355e6", "CI_STEP_STARTED": "1486119585", - "CI_REPO_BRANCH": "master", + "CI_REPO_BRANCH": "main", "CI_REPO_OWNER": "drone", "CI_REPO_SCM": "git", - "PLUGIN_FALLBACK_TO": "master.tar", - "PLUGIN_FILE": "master.tar", + "PLUGIN_FALLBACK_TO": "main.tar", + "PLUGIN_FILE": "main.tar", "PLUGIN_MOUNT": "node_modules", "PLUGIN_PATH": "/cache", "PLUGIN_RESTORE": "true" @@ -127,9 +127,9 @@ "CI_PIPELINE_NUMBER": "6", "CI_PIPELINE_STARTED": "1486119585", "CI_COMMIT_AUTHOR": "bradrydzewski", - "CI_COMMIT_BRANCH": "master", + "CI_COMMIT_BRANCH": "main", "CI_COMMIT_MESSAGE": "added a few more test cases for escaping behavior", - "CI_COMMIT_REF": "refs/heads/master", + "CI_COMMIT_REF": "refs/heads/main", "CI_COMMIT_SHA": "d0876d3176965f9552a611cbd56e24a9264355e6", "CI_REMOTE_URL": "https://github.com/drone/envsubst.git", "CI_REPO": "drone/envsubst", @@ -143,11 +143,11 @@ "CI_SYSTEM_NAME": "pipec", "CI_WORKSPACE": "/pipeline/src", "CI_ARCH": "linux/amd64", - "CI_BRANCH": "master", + "CI_BRANCH": "main", "CI_PIPELINE_URL": "https://github.com/cncd/pipec/drone/envsubst/6", "CI_COMMIT": "d0876d3176965f9552a611cbd56e24a9264355e6", "CI_STEP_STARTED": "1486119585", - "CI_REPO_BRANCH": "master", + "CI_REPO_BRANCH": "main", "CI_REPO_OWNER": "drone", "CI_REPO_SCM": "git", "HOME": "/root", @@ -183,9 +183,9 @@ "CI_PIPELINE_NUMBER": "6", "CI_PIPELINE_STARTED": "1486119585", "CI_COMMIT_AUTHOR": "bradrydzewski", - "CI_COMMIT_BRANCH": "master", + "CI_COMMIT_BRANCH": "main", "CI_COMMIT_MESSAGE": "added a few more test cases for escaping behavior", - "CI_COMMIT_REF": "refs/heads/master", + "CI_COMMIT_REF": "refs/heads/main", "CI_COMMIT_SHA": "d0876d3176965f9552a611cbd56e24a9264355e6", "CI_REMOTE_URL": "https://github.com/drone/envsubst.git", "CI_REPO": "drone/envsubst", @@ -198,14 +198,14 @@ "CI_SYSTEM_NAME": "pipec", "CI_WORKSPACE": "/pipeline/src", "CI_ARCH": "linux/amd64", - "CI_BRANCH": "master", + "CI_BRANCH": "main", "CI_PIPELINE_URL": "https://github.com/cncd/pipec/drone/envsubst/6", "CI_COMMIT": "d0876d3176965f9552a611cbd56e24a9264355e6", "CI_STEP_STARTED": "1486119585", - "CI_REPO_BRANCH": "master", + "CI_REPO_BRANCH": "main", "CI_REPO_OWNER": "drone", "CI_REPO_SCM": "git", - "PLUGIN_FILE": "master.tar", + "PLUGIN_FILE": "main.tar", "PLUGIN_FLUSH": "true", "PLUGIN_MOUNT": "node_modules", "PLUGIN_PATH": "/cache", diff --git a/pipeline/schema/.woodpecker/test-branches-array.yml b/pipeline/schema/.woodpecker/test-branches-array.yml index 15b67f60ac..d530db0550 100644 --- a/pipeline/schema/.woodpecker/test-branches-array.yml +++ b/pipeline/schema/.woodpecker/test-branches-array.yml @@ -1,4 +1,4 @@ -branches: [master, pages] +branches: [main, pages] steps: build: diff --git a/pipeline/schema/.woodpecker/test-branches-exclude-include.yml b/pipeline/schema/.woodpecker/test-branches-exclude-include.yml index 40d58bee51..03b534d235 100644 --- a/pipeline/schema/.woodpecker/test-branches-exclude-include.yml +++ b/pipeline/schema/.woodpecker/test-branches-exclude-include.yml @@ -1,6 +1,6 @@ branches: - include: master - exclude: [ develop, feature/* ] + include: main + exclude: [develop, feature/*] steps: build: diff --git a/pipeline/schema/.woodpecker/test-branches.yml b/pipeline/schema/.woodpecker/test-branches.yml index 3d45475c5e..75b72bbcf5 100644 --- a/pipeline/schema/.woodpecker/test-branches.yml +++ b/pipeline/schema/.woodpecker/test-branches.yml @@ -1,4 +1,4 @@ -branches: master +branches: main steps: build: diff --git a/pipeline/schema/.woodpecker/test-broken.yml b/pipeline/schema/.woodpecker/test-broken.yml index c0dda77d7d..17d7218655 100644 --- a/pipeline/schema/.woodpecker/test-broken.yml +++ b/pipeline/schema/.woodpecker/test-broken.yml @@ -1,4 +1,4 @@ -branches: master +branches: main matri: GO_VERSION: diff --git a/pipeline/schema/.woodpecker/test-pipeline-when.yml b/pipeline/schema/.woodpecker/test-pipeline-when.yml index b7dbc97e53..84f02b403a 100644 --- a/pipeline/schema/.woodpecker/test-pipeline-when.yml +++ b/pipeline/schema/.woodpecker/test-pipeline-when.yml @@ -1,10 +1,10 @@ when: - - branch: [master, deploy] + - branch: [main, deploy] event: push path: - - "folder/**" - - "**/*.c" - - tag: "v**" + - 'folder/**' + - '**/*.c' + - tag: 'v**' event: tag - event: cron cron: diff --git a/pipeline/schema/.woodpecker/test-when.yml b/pipeline/schema/.woodpecker/test-when.yml index fc820bcd85..721c92bf8c 100644 --- a/pipeline/schema/.woodpecker/test-when.yml +++ b/pipeline/schema/.woodpecker/test-when.yml @@ -4,14 +4,14 @@ steps: commands: - echo "test" when: - branch: master + branch: main when-branch-array: image: alpine commands: - echo "test" when: - branch: [master, deploy] + branch: [main, deploy] when-event: image: alpine @@ -32,7 +32,7 @@ steps: commands: - echo "test" when: - ref: "refs/tags/v**" + ref: 'refs/tags/v**' when-status: image: alpine @@ -53,7 +53,7 @@ steps: commands: - echo "test" when: - platform: [ linux/*, windows/amd64 ] + platform: [linux/*, windows/amd64] when-environment: image: alpine @@ -84,7 +84,7 @@ steps: commands: - echo "test" when: - path: "folder/**" + path: 'folder/**' when-path-array: image: alpine @@ -92,8 +92,8 @@ steps: - echo "test" when: path: - - "folder/**" - - "**/*.c" + - 'folder/**' + - '**/*.c' when-path-include-exclude: image: alpine @@ -101,9 +101,9 @@ steps: - echo "test" when: path: - include: [ '.woodpecker/*.yml', '*.ini' ] - exclude: [ '*.md', 'docs/**' ] - ignore_message: "[ALL]" + include: ['.woodpecker/*.yml', '*.ini'] + exclude: ['*.md', 'docs/**'] + ignore_message: '[ALL]' when-repo: image: alpine @@ -127,7 +127,7 @@ steps: commands: - echo "test" when: - cron: "update locales" + cron: 'update locales' event: cron when-cron-list: diff --git a/pipeline/stepBuilder_test.go b/pipeline/stepBuilder_test.go index 4c374536f8..a0ebc1b7c9 100644 --- a/pipeline/stepBuilder_test.go +++ b/pipeline/stepBuilder_test.go @@ -307,7 +307,7 @@ func TestBranchFilter(t *testing.T) { steps: xxx: image: scratch -branches: master +branches: main `)}, {Data: []byte(` steps: diff --git a/server/forge/bitbucket/convert_test.go b/server/forge/bitbucket/convert_test.go index 65efded7d9..5fb46b8f60 100644 --- a/server/forge/bitbucket/convert_test.go +++ b/server/forge/bitbucket/convert_test.go @@ -125,7 +125,7 @@ func Test_helper(t *testing.T) { hook.Actor.Login = "octocat" hook.Actor.Links.Avatar.Href = "https://..." hook.PullRequest.Dest.Commit.Hash = "73f9c44d" - hook.PullRequest.Dest.Branch.Name = "master" + hook.PullRequest.Dest.Branch.Name = "main" hook.PullRequest.Dest.Repo.Links.HTML.Href = "https://bitbucket.org/foo/bar" hook.PullRequest.Source.Branch.Name = "change" hook.PullRequest.Source.Repo.FullName = "baz/bar" @@ -140,8 +140,8 @@ func Test_helper(t *testing.T) { g.Assert(pipeline.Commit).Equal(hook.PullRequest.Dest.Commit.Hash) g.Assert(pipeline.Branch).Equal(hook.PullRequest.Dest.Branch.Name) g.Assert(pipeline.Link).Equal(hook.PullRequest.Links.HTML.Href) - g.Assert(pipeline.Ref).Equal("refs/heads/master") - g.Assert(pipeline.Refspec).Equal("change:master") + g.Assert(pipeline.Ref).Equal("refs/heads/main") + g.Assert(pipeline.Refspec).Equal("change:main") g.Assert(pipeline.CloneURL).Equal("https://bitbucket.org/baz/bar") g.Assert(pipeline.Message).Equal(hook.PullRequest.Desc) g.Assert(pipeline.Timestamp).Equal(hook.PullRequest.Updated.Unix()) @@ -150,7 +150,7 @@ func Test_helper(t *testing.T) { g.It("should convert push hook to pipeline", func() { change := internal.Change{} change.New.Target.Hash = "73f9c44d" - change.New.Name = "master" + change.New.Name = "main" change.New.Target.Links.HTML.Href = "https://bitbucket.org/foo/bar/commits/73f9c44d" change.New.Target.Message = "updated README" change.New.Target.Date = time.Now() @@ -168,7 +168,7 @@ func Test_helper(t *testing.T) { g.Assert(pipeline.Commit).Equal(change.New.Target.Hash) g.Assert(pipeline.Branch).Equal(change.New.Name) g.Assert(pipeline.Link).Equal(change.New.Target.Links.HTML.Href) - g.Assert(pipeline.Ref).Equal("refs/heads/master") + g.Assert(pipeline.Ref).Equal("refs/heads/main") g.Assert(pipeline.Message).Equal(change.New.Target.Message) g.Assert(pipeline.Timestamp).Equal(change.New.Target.Date.Unix()) }) diff --git a/server/forge/bitbucket/fixtures/hooks.go b/server/forge/bitbucket/fixtures/hooks.go index 6957651123..b9358a8fa8 100644 --- a/server/forge/bitbucket/fixtures/hooks.go +++ b/server/forge/bitbucket/fixtures/hooks.go @@ -111,7 +111,7 @@ const HookPush = ` "changes": [ { "old": { - "name": "master", + "name": "main", "target": { "type": "commit", "hash": "a51241ae1f00cbe728930db48e890b18fd527f99", @@ -159,13 +159,13 @@ const HookPush = ` }, "links": { "self": { - "href": "https://api.bitbucket.org/2.0/repositories/martinherren1984/publictestrepo/refs/branches/master" + "href": "https://api.bitbucket.org/2.0/repositories/martinherren1984/publictestrepo/refs/branches/main" }, "commits": { - "href": "https://api.bitbucket.org/2.0/repositories/martinherren1984/publictestrepo/commits/master" + "href": "https://api.bitbucket.org/2.0/repositories/martinherren1984/publictestrepo/commits/main" }, "html": { - "href": "https://bitbucket.org/martinherren1984/publictestrepo/branch/master" + "href": "https://bitbucket.org/martinherren1984/publictestrepo/branch/main" } }, "type": "branch", @@ -177,7 +177,7 @@ const HookPush = ` "default_merge_strategy": "merge_commit" }, "new": { - "name": "master", + "name": "main", "target": { "type": "commit", "hash": "c14c1bb05dfb1fdcdf06b31485fff61b0ea44277", @@ -238,13 +238,13 @@ const HookPush = ` }, "links": { "self": { - "href": "https://api.bitbucket.org/2.0/repositories/martinherren1984/publictestrepo/refs/branches/master" + "href": "https://api.bitbucket.org/2.0/repositories/martinherren1984/publictestrepo/refs/branches/main" }, "commits": { - "href": "https://api.bitbucket.org/2.0/repositories/martinherren1984/publictestrepo/commits/master" + "href": "https://api.bitbucket.org/2.0/repositories/martinherren1984/publictestrepo/commits/main" }, "html": { - "href": "https://bitbucket.org/martinherren1984/publictestrepo/branch/master" + "href": "https://bitbucket.org/martinherren1984/publictestrepo/branch/main" } }, "type": "branch", @@ -412,7 +412,7 @@ const HookPull = ` }, "destination": { "branch": { - "name": "master" + "name": "main" }, "commit": { "hash": "ce5965ddd289" diff --git a/server/forge/gitea/fixtures/hooks.go b/server/forge/gitea/fixtures/hooks.go index 3890b0214e..5140a83964 100644 --- a/server/forge/gitea/fixtures/hooks.go +++ b/server/forge/gitea/fixtures/hooks.go @@ -17,7 +17,7 @@ package fixtures // HookPush is a sample Gitea push hook const HookPush = ` { - "ref": "refs/heads/master", + "ref": "refs/heads/main", "before": "4b2626259b5a97b6b4eab5e6cca66adb986b672b", "after": "ef98532add3b2feb7a137426bba1248724367df5", "compare_url": "http://gitea.golang.org/gordon/hello-world/compare/4b2626259b5a97b6b4eab5e6cca66adb986b672b...ef98532add3b2feb7a137426bba1248724367df5", @@ -81,7 +81,7 @@ const HookPushBranch = ` "ref": "refs/heads/fdsafdsa", "before": "0000000000000000000000000000000000000000", "after": "28c3613ae62640216bea5e7dc71aa65356e4298b", - "compare_url": "https://codeberg.org/meisam/woodpecktester/compare/master...28c3613ae62640216bea5e7dc71aa65356e4298b", + "compare_url": "https://codeberg.org/meisam/woodpecktester/compare/main...28c3613ae62640216bea5e7dc71aa65356e4298b", "commits": [], "head_commit": { "id": "28c3613ae62640216bea5e7dc71aa65356e4298b", @@ -157,7 +157,7 @@ const HookPushBranch = ` "open_issues_count": 0, "open_pr_counter": 0, "release_counter": 0, - "default_branch": "master", + "default_branch": "main", "archived": false, "created_at": "2022-07-04T00:34:39+02:00", "updated_at": "2022-07-24T20:31:29+02:00", @@ -253,7 +253,7 @@ const HookPushTag = `{ "html_url": "http://gitea.golang.org/gordon/hello-world", "ssh_url": "git@gitea.golang.org:gordon/hello-world.git", "clone_url": "http://gitea.golang.org/gordon/hello-world.git", - "default_branch": "master", + "default_branch": "main", "created_at": "2015-10-22T19:32:44Z", "updated_at": "2016-11-24T13:37:16Z", "permissions": { @@ -290,8 +290,8 @@ const HookPullRequest = `{ "avatar_url": "http://gitea.golang.org///1.gravatar.com/avatar/8c58a0be77ee441bb8f8595b7f1b4e87" }, "base": { - "label": "master", - "ref": "master", + "label": "main", + "ref": "main", "sha": "9353195a19e45482665306e466c832c46560532d" }, "head": { @@ -315,7 +315,7 @@ const HookPullRequest = `{ "private": true, "html_url": "http://gitea.golang.org/gordon/hello-world", "clone_url": "https://gitea.golang.org/gordon/hello-world.git", - "default_branch": "master", + "default_branch": "main", "permissions": { "admin": true, "push": true, diff --git a/server/forge/gitea/helper_test.go b/server/forge/gitea/helper_test.go index 47f749cb8c..0add63874e 100644 --- a/server/forge/gitea/helper_test.go +++ b/server/forge/gitea/helper_test.go @@ -34,7 +34,7 @@ func Test_parse(t *testing.T) { buf := bytes.NewBufferString(fixtures.HookPush) hook, err := parsePush(buf) g.Assert(err).IsNil() - g.Assert(hook.Ref).Equal("refs/heads/master") + g.Assert(hook.Ref).Equal("refs/heads/main") g.Assert(hook.After).Equal("ef98532add3b2feb7a137426bba1248724367df5") g.Assert(hook.Before).Equal("4b2626259b5a97b6b4eab5e6cca66adb986b672b") g.Assert(hook.Compare).Equal("http://gitea.golang.org/gordon/hello-world/compare/4b2626259b5a97b6b4eab5e6cca66adb986b672b...ef98532add3b2feb7a137426bba1248724367df5") @@ -86,8 +86,8 @@ func Test_parse(t *testing.T) { g.Assert(hook.PullRequest.Body).Equal("please merge") g.Assert(hook.PullRequest.State).Equal(gitea.StateOpen) g.Assert(hook.PullRequest.Poster.UserName).Equal("gordon") - g.Assert(hook.PullRequest.Base.Name).Equal("master") - g.Assert(hook.PullRequest.Base.Ref).Equal("master") + g.Assert(hook.PullRequest.Base.Name).Equal("main") + g.Assert(hook.PullRequest.Base.Ref).Equal("main") g.Assert(hook.PullRequest.Head.Name).Equal("feature/changes") g.Assert(hook.PullRequest.Head.Ref).Equal("feature/changes") }) @@ -100,7 +100,7 @@ func Test_parse(t *testing.T) { g.Assert(pipeline.Commit).Equal(hook.After) g.Assert(pipeline.Ref).Equal(hook.Ref) g.Assert(pipeline.Link).Equal(hook.Commits[0].URL) - g.Assert(pipeline.Branch).Equal("master") + g.Assert(pipeline.Branch).Equal("main") g.Assert(pipeline.Message).Equal(hook.Commits[0].Message) g.Assert(pipeline.Avatar).Equal("http://1.gravatar.com/avatar/8c58a0be77ee441bb8f8595b7f1b4e87") g.Assert(pipeline.Author).Equal(hook.Sender.UserName) @@ -137,8 +137,8 @@ func Test_parse(t *testing.T) { g.Assert(pipeline.Commit).Equal(hook.PullRequest.Head.Sha) g.Assert(pipeline.Ref).Equal("refs/pull/1/head") g.Assert(pipeline.Link).Equal(hook.PullRequest.URL) - g.Assert(pipeline.Branch).Equal("master") - g.Assert(pipeline.Refspec).Equal("feature/changes:master") + g.Assert(pipeline.Branch).Equal("main") + g.Assert(pipeline.Refspec).Equal("feature/changes:main") g.Assert(pipeline.Message).Equal(hook.PullRequest.Title) g.Assert(pipeline.Avatar).Equal("http://1.gravatar.com/avatar/8c58a0be77ee441bb8f8595b7f1b4e87") g.Assert(pipeline.Author).Equal(hook.PullRequest.Poster.UserName) @@ -201,14 +201,14 @@ func Test_parse(t *testing.T) { CloneURL: "http://gitea.golang.org/gophers/hello-world.git", HTMLURL: "http://gitea.golang.org/gophers/hello-world", Private: true, - DefaultBranch: "master", + DefaultBranch: "main", Permissions: &gitea.Permission{Admin: true}, } repo := toRepo(&from) g.Assert(repo.FullName).Equal(from.FullName) g.Assert(repo.Owner).Equal(from.Owner.UserName) g.Assert(repo.Name).Equal("hello-world") - g.Assert(repo.Branch).Equal("master") + g.Assert(repo.Branch).Equal("main") g.Assert(repo.Link).Equal(from.HTMLURL) g.Assert(repo.Clone).Equal(from.CloneURL) g.Assert(repo.Avatar).Equal(from.Owner.AvatarURL) diff --git a/server/forge/github/convert_test.go b/server/forge/github/convert_test.go index 0eb1691c7b..6c05e7202a 100644 --- a/server/forge/github/convert_test.go +++ b/server/forge/github/convert_test.go @@ -188,7 +188,7 @@ func Test_helper(t *testing.T) { Number: github.Int(42), Title: github.String("Updated README.md"), Base: &github.PullRequestBranch{ - Ref: github.String("master"), + Ref: github.String("main"), }, Head: &github.PullRequestBranch{ Ref: github.String("changes"), @@ -211,7 +211,7 @@ func Test_helper(t *testing.T) { g.Assert(pipeline.Event).Equal(model.EventPull) g.Assert(pipeline.Branch).Equal(*from.PullRequest.Base.Ref) g.Assert(pipeline.Ref).Equal("refs/pull/42/merge") - g.Assert(pipeline.Refspec).Equal("changes:master") + g.Assert(pipeline.Refspec).Equal("changes:main") g.Assert(pipeline.CloneURL).Equal("https://github.com/octocat/hello-world-fork") g.Assert(pipeline.Commit).Equal(*from.PullRequest.Head.SHA) g.Assert(pipeline.Message).Equal(*from.PullRequest.Title) @@ -226,7 +226,7 @@ func Test_helper(t *testing.T) { from.Deployment.Description = github.String(":shipit:") from.Deployment.Environment = github.String("production") from.Deployment.ID = github.Int64(42) - from.Deployment.Ref = github.String("master") + from.Deployment.Ref = github.String("main") from.Deployment.SHA = github.String("f72fc19") from.Deployment.URL = github.String("https://github.com/octocat/hello-world") from.Sender.Login = github.String("octocat") @@ -235,8 +235,8 @@ func Test_helper(t *testing.T) { _, pipeline, err := parseDeployHook(from) g.Assert(err).IsNil() g.Assert(pipeline.Event).Equal(model.EventDeploy) - g.Assert(pipeline.Branch).Equal("master") - g.Assert(pipeline.Ref).Equal("refs/heads/master") + g.Assert(pipeline.Branch).Equal("main") + g.Assert(pipeline.Ref).Equal("refs/heads/main") g.Assert(pipeline.Commit).Equal(*from.Deployment.SHA) g.Assert(pipeline.Message).Equal(*from.Deployment.Description) g.Assert(pipeline.Link).Equal(*from.Deployment.URL) @@ -253,13 +253,13 @@ func Test_helper(t *testing.T) { from.HeadCommit.Message = github.String("updated README.md") from.HeadCommit.URL = github.String("https://github.com/octocat/hello-world") from.HeadCommit.ID = github.String("f72fc19") - from.Ref = github.String("refs/heads/master") + from.Ref = github.String("refs/heads/main") _, pipeline, err := parsePushHook(from) g.Assert(err).IsNil() g.Assert(pipeline.Event).Equal(model.EventPush) - g.Assert(pipeline.Branch).Equal("master") - g.Assert(pipeline.Ref).Equal("refs/heads/master") + g.Assert(pipeline.Branch).Equal("main") + g.Assert(pipeline.Ref).Equal("refs/heads/main") g.Assert(pipeline.Commit).Equal(*from.HeadCommit.ID) g.Assert(pipeline.Message).Equal(*from.HeadCommit.Message) g.Assert(pipeline.Link).Equal(*from.HeadCommit.URL) @@ -282,18 +282,18 @@ func Test_helper(t *testing.T) { g.It("should convert tag's base branch from webhook to pipeline's branch ", func() { from := &github.PushEvent{} from.Ref = github.String("refs/tags/v1.0.0") - from.BaseRef = github.String("refs/heads/master") + from.BaseRef = github.String("refs/heads/main") _, pipeline, err := parsePushHook(from) g.Assert(err).IsNil() g.Assert(pipeline.Event).Equal(model.EventTag) - g.Assert(pipeline.Branch).Equal("master") + g.Assert(pipeline.Branch).Equal("main") }) g.It("should not convert tag's base_ref from webhook if not prefixed with 'ref/heads/'", func() { from := &github.PushEvent{} from.Ref = github.String("refs/tags/v1.0.0") - from.BaseRef = github.String("refs/refs/master") + from.BaseRef = github.String("refs/refs/main") _, pipeline, err := parsePushHook(from) g.Assert(err).IsNil() diff --git a/server/forge/github/fixtures/hooks.go b/server/forge/github/fixtures/hooks.go index c17938da69..73d5a4d7e8 100644 --- a/server/forge/github/fixtures/hooks.go +++ b/server/forge/github/fixtures/hooks.go @@ -17,7 +17,7 @@ package fixtures // HookPush is a sample push hook. // https://developer.github.com/v3/activity/events/types/#pushevent const HookPush = `{ - "ref": "refs/heads/master", + "ref": "refs/heads/main", "before": "2f780193b136b72bfea4eeb640786a8c4450c7a2", "after": "366701fde727cb7a9e7f21eb88264f59f6f9b89c", "repository": { @@ -131,9 +131,9 @@ const HookPush = `{ "forks": 84, "open_issues": 123, "watchers": 659, - "default_branch": "master", + "default_branch": "main", "stargazers": 659, - "master_branch": "master", + "main_branch": "main", "organization": "woodpecker-ci" }, "pusher": { @@ -263,8 +263,8 @@ const HookPullRequest = ` "avatar_url": "https://avatars.githubusercontent.com/u/6752317?v=3" }, "base": { - "label": "baxterthehacker:master", - "ref": "master", + "label": "baxterthehacker:main", + "ref": "main", "sha": "9353195a19e45482665306e466c832c46560532d" }, "head": { @@ -284,7 +284,7 @@ const HookPullRequest = ` "private": true, "html_url": "https://github.com/baxterthehacker/public-repo", "clone_url": "https://github.com/baxterthehacker/public-repo.git", - "default_branch": "master" + "default_branch": "main" }, "sender": { "login": "octocat", @@ -322,7 +322,7 @@ const HookDeploy = ` "url": "https://api.github.com/repos/baxterthehacker/public-repo/deployments/710692", "id": 710692, "sha": "9049f1265b7d61be4a8904a9a27120d2064dab3b", - "ref": "master", + "ref": "main", "task": "deploy", "payload": { }, @@ -344,7 +344,7 @@ const HookDeploy = ` "private": true, "html_url": "https://github.com/baxterthehacker/public-repo", "clone_url": "https://github.com/baxterthehacker/public-repo.git", - "default_branch": "master" + "default_branch": "main" }, "sender": { "login": "baxterthehacker", diff --git a/server/forge/gitlab/gitlab_test.go b/server/forge/gitlab/gitlab_test.go index 927c7fd916..767a322c6e 100644 --- a/server/forge/gitlab/gitlab_test.go +++ b/server/forge/gitlab/gitlab_test.go @@ -149,7 +149,7 @@ func Test_GitLab(t *testing.T) { assert.Equal(t, "woodpecker", hookRepo.Name) assert.Equal(t, "http://example.com/uploads/project/avatar/555/Outh-20-Logo.jpg", hookRepo.Avatar) assert.Equal(t, "develop", hookRepo.Branch) - assert.Equal(t, "refs/heads/master", pipeline.Ref) + assert.Equal(t, "refs/heads/main", pipeline.Ref) assert.Equal(t, []string{"cmd/cli/main.go"}, pipeline.ChangedFiles) } }) diff --git a/server/forge/gitlab/testdata/hooks.go b/server/forge/gitlab/testdata/hooks.go index 7d39306b62..2d1a1bb143 100644 --- a/server/forge/gitlab/testdata/hooks.go +++ b/server/forge/gitlab/testdata/hooks.go @@ -37,7 +37,7 @@ var ServiceHookPushBody = []byte(`{ "event_name": "push", "before": "ffe8eb4f91d1fe6bc49f1e610e50e4b5767f0104", "after": "16862e368d8ab812e48833b741dad720d6e2cb7f", - "ref": "refs/heads/master", + "ref": "refs/heads/main", "checkout_sha": "16862e368d8ab812e48833b741dad720d6e2cb7f", "message": null, "user_id": 2, diff --git a/server/forge/gitlab/testdata/projects.go b/server/forge/gitlab/testdata/projects.go index c64468a4c5..bb45fdeaab 100644 --- a/server/forge/gitlab/testdata/projects.go +++ b/server/forge/gitlab/testdata/projects.go @@ -20,7 +20,7 @@ var allProjectsPayload = []byte(` { "id": 4, "description": null, - "default_branch": "master", + "default_branch": "main", "public": false, "visibility_level": 0, "ssh_url_to_repo": "git@example.com:diaspora/diaspora-client.git", @@ -66,7 +66,7 @@ var allProjectsPayload = []byte(` { "id": 6, "description": null, - "default_branch": "master", + "default_branch": "main", "public": false, "visibility_level": 0, "ssh_url_to_repo": "git@example.com:brightbox/puppet.git", @@ -117,7 +117,7 @@ var notArchivedProjectsPayload = []byte(` { "id": 4, "description": null, - "default_branch": "master", + "default_branch": "main", "public": false, "visibility_level": 0, "ssh_url_to_repo": "git@example.com:diaspora/diaspora-client.git", @@ -167,7 +167,7 @@ var project4Payload = []byte(` { "id": 4, "description": null, - "default_branch": "master", + "default_branch": "main", "public": false, "visibility_level": 0, "ssh_url_to_repo": "git@example.com:diaspora/diaspora-client.git", @@ -216,7 +216,7 @@ var project6Payload = []byte(` { "id": 6, "description": null, - "default_branch": "master", + "default_branch": "main", "public": false, "visibility_level": 0, "ssh_url_to_repo": "git@example.com:brightbox/puppet.git", diff --git a/server/store/datastore/pipeline_test.go b/server/store/datastore/pipeline_test.go index c54ed5e87d..a19f87082f 100644 --- a/server/store/datastore/pipeline_test.go +++ b/server/store/datastore/pipeline_test.go @@ -193,7 +193,7 @@ func TestPipelines(t *testing.T) { pipeline1 := &model.Pipeline{ RepoID: repo.ID, Status: model.StatusPending, - Branch: "master", + Branch: "main", Commit: "85f8c029b902ed9400bc600bac301a0aadb144ac", } pipeline2 := &model.Pipeline{ @@ -219,14 +219,14 @@ func TestPipelines(t *testing.T) { pipeline1 := &model.Pipeline{ RepoID: repo.ID, Status: model.StatusFailure, - Branch: "master", + Branch: "main", Commit: "85f8c029b902ed9400bc600bac301a0aadb144ac", Event: model.EventPush, } pipeline2 := &model.Pipeline{ RepoID: repo.ID, Status: model.StatusSuccess, - Branch: "master", + Branch: "main", Commit: "85f8c029b902ed9400bc600bac301a0aadb144aa", Event: model.EventPush, } @@ -248,19 +248,19 @@ func TestPipelines(t *testing.T) { pipeline1 := &model.Pipeline{ RepoID: repo.ID, Status: model.StatusFailure, - Branch: "master", + Branch: "main", Commit: "85f8c029b902ed9400bc600bac301a0aadb144ac", } pipeline2 := &model.Pipeline{ RepoID: repo.ID, Status: model.StatusSuccess, - Branch: "master", + Branch: "main", Commit: "85f8c029b902ed9400bc600bac301a0aadb144aa", } pipeline3 := &model.Pipeline{ RepoID: repo.ID, Status: model.StatusRunning, - Branch: "master", + Branch: "main", Commit: "85f8c029b902ed9400bc600bac301a0aadb144aa", } err1 := store.CreatePipeline(pipeline1, []*model.Step{}...)