Compare commits

...

2 Commits

Author SHA1 Message Date
e4ff32cc94 Merge pull request '#14 deprecate migration_clone_addresse in favor of migration_clone_address' (#15) from bugfix/#14-fix-typo into main
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/tag Build is passing
Reviewed-on: #15
closes #14
2022-08-14 19:12:59 +00:00
c4757ce109
#14 deprecate migration_clone_addresse in favor of migration_clone_address
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
2022-08-14 20:55:12 +02:00
6 changed files with 24 additions and 7 deletions

View File

@ -3,7 +3,7 @@ GOFMT_FILES?=$$(find . -name '*.go' |grep -v vendor)
GOFMT ?= gofmt -s GOFMT ?= gofmt -s
VERSION = 0.7.2 VERSION = 0.7.3
test: fmt-check test: fmt-check
go test -i $(TEST) || exit 1 go test -i $(TEST) || exit 1

View File

@ -17,7 +17,7 @@ terraform {
required_providers { required_providers {
gitea = { gitea = {
source = "Lerentis/gitea" source = "Lerentis/gitea"
version = "0.7.2" version = "0.7.3"
} }
} }
} }

View File

@ -72,7 +72,8 @@ Need to exist in the gitea instance
Need to exist in the gitea instance Need to exist in the gitea instance
- `license` (String) The license under which the source code of this repository should be. - `license` (String) The license under which the source code of this repository should be.
Need to exist in the gitea instance Need to exist in the gitea instance
- `migration_clone_addresse` (String) - `migration_clone_address` (String)
- `migration_clone_addresse` (String) DEPRECATED in favor of `migration_clone_address`
- `migration_issue_labels` (Boolean) - `migration_issue_labels` (Boolean)
- `migration_lfs` (Boolean) - `migration_lfs` (Boolean)
- `migration_lfs_endpoint` (String) - `migration_lfs_endpoint` (String)

View File

@ -12,7 +12,7 @@ resource "gitea_repository" "mirror" {
name = "terraform-provider-gitea-mirror" name = "terraform-provider-gitea-mirror"
description = "Mirror of Terraform Provider" description = "Mirror of Terraform Provider"
mirror = true mirror = true
migration_clone_addresse = "https://git.uploadfilter24.eu/lerentis/terraform-provider-gitea.git" migration_clone_address = "https://git.uploadfilter24.eu/lerentis/terraform-provider-gitea.git"
migration_service = "gitea" migration_service = "gitea"
migration_service_auth_token = var.gitea_mirror_token migration_service_auth_token = var.gitea_mirror_token
} }

View File

@ -2,7 +2,7 @@ terraform {
required_providers { required_providers {
gitea = { gitea = {
source = "terraform.local/lerentis/gitea" source = "terraform.local/lerentis/gitea"
version = "0.7.2" version = "0.8.0"
} }
} }
} }

View File

@ -34,7 +34,8 @@ const (
repoAllowManualMerge string = "allow_manual_merge" repoAllowManualMerge string = "allow_manual_merge"
repoAutodetectManualMerge string = "autodetect_manual_merge" repoAutodetectManualMerge string = "autodetect_manual_merge"
repoMirror string = "mirror" repoMirror string = "mirror"
migrationCloneAddress string = "migration_clone_addresse" migrationCloneAddresse string = "migration_clone_addresse"
migrationCloneAddress string = "migration_clone_address"
migrationService string = "migration_service" migrationService string = "migration_service"
migrationServiceAuthName string = "migration_service_auth_username" migrationServiceAuthName string = "migration_service_auth_username"
migrationServiceAuthPassword string = "migration_service_auth_password" migrationServiceAuthPassword string = "migration_service_auth_password"
@ -89,10 +90,18 @@ func resourceRepoCreate(d *schema.ResourceData, meta interface{}) (err error) {
} }
if (d.Get(repoMirror)).(bool) { if (d.Get(repoMirror)).(bool) {
var cloneAddr string
if d.Get(migrationCloneAddresse).(string) != "" {
cloneAddr = d.Get(migrationCloneAddresse).(string)
} else {
cloneAddr = d.Get(migrationCloneAddress).(string)
}
opts := gitea.MigrateRepoOption{ opts := gitea.MigrateRepoOption{
RepoName: d.Get(repoName).(string), RepoName: d.Get(repoName).(string),
RepoOwner: d.Get(repoOwner).(string), RepoOwner: d.Get(repoOwner).(string),
CloneAddr: d.Get(migrationCloneAddress).(string), CloneAddr: cloneAddr,
Service: gitea.GitServiceType(d.Get(migrationService).(string)), Service: gitea.GitServiceType(d.Get(migrationService).(string)),
Mirror: d.Get(repoMirror).(bool), Mirror: d.Get(repoMirror).(bool),
Private: d.Get(repoPrivateFlag).(bool), Private: d.Get(repoPrivateFlag).(bool),
@ -445,6 +454,13 @@ func resourceGiteaRepository() *schema.Resource {
Default: false, Default: false,
}, },
"migration_clone_addresse": { "migration_clone_addresse": {
Type: schema.TypeString,
Required: false,
Optional: true,
ForceNew: true,
Description: "DEPRECATED in favor of `migration_clone_address`",
},
"migration_clone_address": {
Type: schema.TypeString, Type: schema.TypeString,
Required: false, Required: false,
Optional: true, Optional: true,