Compare commits

..

3 Commits

Author SHA1 Message Date
Tobias Trabelsi
b2403e2569
Merge pull request #40 from ultimania/feature/non-mirror-migration
Some checks reported errors
continuous-integration/drone/push Build is passing
continuous-integration/drone/tag Build encountered an error
Fixed conditions of repository migration
2023-05-31 09:26:02 +02:00
ultimania
98867f2830 add example for origin migration 2023-05-31 10:56:18 +09:00
ultimania
948b20a6d2 fixed conditions of migration 2023-05-31 08:54:45 +09:00
8 changed files with 32 additions and 12 deletions

View File

@ -5,7 +5,7 @@ KERNEL?=$$(uname -s | tr '[:upper:]' '[:lower:]')
GOFMT ?= gofmt -s GOFMT ?= gofmt -s
VERSION = 0.13.0 VERSION = 0.14.0
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.13.0" version = "0.14.0"
} }
} }
} }

View File

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

View File

@ -41,6 +41,16 @@ resource "gitea_repository" "mirror" {
migration_service = "gitea" migration_service = "gitea"
migration_service_auth_token = var.gitea_mirror_token migration_service_auth_token = var.gitea_mirror_token
} }
resource "gitea_repository" "clone" {
username = "lerentis"
name = "terraform-provider-gitea-clone"
description = "Clone of Terraform Provider"
mirror = false
migration_clone_address = "https://git.uploadfilter24.eu/lerentis/terraform-provider-gitea.git"
migration_service = "gitea"
migration_service_auth_token = var.gitea_clone_token
}
``` ```
<!-- schema generated by tfplugindocs --> <!-- schema generated by tfplugindocs -->

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.13.0" version = "0.14.0"
} }
} }
} }

View File

@ -2,7 +2,7 @@ terraform {
required_providers { required_providers {
gitea = { gitea = {
source = "Lerentis/gitea" source = "Lerentis/gitea"
version = "0.13.0" version = "0.14.0"
} }
} }
} }

View File

@ -16,3 +16,13 @@ resource "gitea_repository" "mirror" {
migration_service = "gitea" migration_service = "gitea"
migration_service_auth_token = var.gitea_mirror_token migration_service_auth_token = var.gitea_mirror_token
} }
resource "gitea_repository" "clone" {
username = "lerentis"
name = "terraform-provider-gitea-clone"
description = "Clone of Terraform Provider"
mirror = false
migration_clone_address = "https://git.uploadfilter24.eu/lerentis/terraform-provider-gitea.git"
migration_service = "gitea"
migration_service_auth_token = var.gitea_clone_token
}

View File

@ -131,8 +131,6 @@ func resourceRepoCreate(d *schema.ResourceData, meta interface{}) (err error) {
orgRepo = true orgRepo = true
} }
if (d.Get(repoMirror)).(bool) {
var cloneAddr string var cloneAddr string
if d.Get(migrationCloneAddresse).(string) != "" { if d.Get(migrationCloneAddresse).(string) != "" {
cloneAddr = d.Get(migrationCloneAddresse).(string) cloneAddr = d.Get(migrationCloneAddresse).(string)
@ -140,6 +138,8 @@ func resourceRepoCreate(d *schema.ResourceData, meta interface{}) (err error) {
cloneAddr = d.Get(migrationCloneAddress).(string) cloneAddr = d.Get(migrationCloneAddress).(string)
} }
if cloneAddr != "" {
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),