feat: init fork

This commit is contained in:
sinavir 2025-03-08 23:02:52 +01:00
parent 0107199941
commit d9bf396917
No known key found for this signature in database
9 changed files with 10 additions and 125 deletions

2
.gitignore vendored
View file

@ -4,3 +4,5 @@ dist/
tests/terraform.tfvars
tests/.terraform
tests/.terraform.lock.hcl
forgejo-terraform-provider

View file

@ -1,5 +1,6 @@
The MIT License (MIT)
Copyright (c) 2025 Maurice Debray, https://git.dgnum.eu/mdebray/forgejo-terraform-provider
Copyright (c) 2022 lerentis, https://git.uploadfilter24.eu/lerentis
Copyright (c) 2022 The Gitea Authors

View file

@ -32,11 +32,6 @@ fmt-check:
exit 1; \
fi;
build:
go build -ldflags="-X 'main.Version=${VERSION}'" -o terraform-provider-gitea_${VERSION}
go build -ldflags="-X 'main.Version=${VERSION}'" -o forgejo-terraform-provider_${VERSION}
doc:
tfplugindocs
install: build
@echo installing to
@echo ~/.terraform.d/plugins/terraform.local/go-gitea/gitea/${VERSION}/${KERNEL}_${ARCH}/terraform-provider-gitea_${VERSION}
@mkdir -p ~/.terraform.d/plugins/terraform.local/go-gitea/gitea/${VERSION}/${KERNEL}_${ARCH}
@mv terraform-provider-gitea_${VERSION} ~/.terraform.d/plugins/terraform.local/go-gitea/gitea/${VERSION}/${KERNEL}_${ARCH}/terraform-provider-gitea_${VERSION}

View file

@ -1,68 +1,6 @@
# terraform-provider-gitea
# forgejo-terraform-provider
Terraform Gitea Provider
This repo is mirrored from https://gitea.com/gitea/terraform-provider-gitea please send all issues and pull requests there.
## Usage
This is not a 1.0 release, so usage is subject to change!
```terraform
terraform {
required_providers {
gitea = {
source = "go-gitea/gitea"
version = "0.6.0"
}
}
}
provider "gitea" {
base_url = var.gitea_url # optionally use GITEA_BASE_URL env var
token = var.gitea_token # optionally use GITEA_TOKEN env var
# Username/Password authentication is mutally exclusive with token authentication
# username = var.username # optionally use GITEA_USERNAME env var
# password = var.password # optionally use GITEA_PASSWORD env var
# A file containing the ca certificate to use in case ssl certificate is not from a standard chain
cacert_file = var.cacert_file
# If you are running a gitea instance with self signed TLS certificates
# and you want to disable certificate validation you can deactivate it with this flag
insecure = false
}
resource "gitea_repository" "test" {
username = "lerentis"
name = "test"
private = true
issue_labels = "Default"
license = "MIT"
gitignores = "Go"
}
resource "gitea_repository" "mirror" {
username = "lerentis"
name = "terraform-provider-gitea-mirror"
description = "Mirror of Terraform Provider"
mirror = true
migration_clone_addresse = "https://git.uploadfilter24.eu/lerentis/terraform-provider-gitea.git"
migration_service = "gitea"
migration_service_auth_token = var.gitea_mirror_token
}
resource "gitea_org" "test_org" {
name = "test-org"
}
resource "gitea_repository" "org_repo" {
username = gitea_org.test_org.name
name = "org-test-repo"
}
```
Terraform Forgjo Provider
## License
@ -70,4 +8,4 @@ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file
## History
This codebase was created at https://gitea.com/gitea/terraform-provider-gitea, was forked by @lerentis, and then their changes were merged back into the original repo. Thank you to everyone who contributed!
This repo is based on the gitea terraform provider

2
go.mod
View file

@ -1,4 +1,4 @@
module code.gitea.io/terraform-provider-gitea
module git.dgnum.eu/mdebray/forgejo-terraform-provider
go 1.22.7

View file

@ -1,7 +1,7 @@
package main // import "code.gitea.ioterraform-provider-gitea"
package main
import (
"code.gitea.io/terraform-provider-gitea/gitea"
"git.dgnum.eu/mdebray/forgejo-terraform-provider/gitea"
"github.com/hashicorp/terraform-plugin-sdk/v2/plugin"
)

View file

@ -1,23 +0,0 @@
version: "3"
networks:
gitea:
external: false
services:
server:
image: gitea/gitea:1.23.3
container_name: gitea
environment:
- USER_UID=1000
- USER_GID=1000
- DISABLE_GIT_HOOKS=false
restart: always
networks:
- gitea
volumes:
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
ports:
- "3000:3000"
- "222:22"

View file

@ -1,28 +0,0 @@
#!/bin/bash -e
WORK_DIR=`pwd`
GITEA_SDK_TEST_USERNAME=test01
GITEA_SDK_TEST_PASSWORD=test01
mkdir -p ${WORK_DIR}/test/conf/ ${WORK_DIR}/test/data/
wget --quiet "https://dl.gitea.io/gitea/main/gitea-main-linux-amd64" -O ${WORK_DIR}/test/gitea-main
chmod +x ${WORK_DIR}/test/gitea-main
echo "[security]" > ${WORK_DIR}/test/conf/app.ini
echo "INTERNAL_TOKEN = eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYmYiOjE1NTg4MzY4ODB9.LoKQyK5TN_0kMJFVHWUW0uDAyoGjDP6Mkup4ps2VJN4" >> ${WORK_DIR}/test/conf/app.ini
echo "INSTALL_LOCK = true" >> ${WORK_DIR}/test/conf/app.ini
echo "SECRET_KEY = 2crAW4UANgvLipDS6U5obRcFosjSJHQANll6MNfX7P0G3se3fKcCwwK3szPyGcbo" >> ${WORK_DIR}/test/conf/app.ini
echo "PASSWORD_COMPLEXITY = off" >> ${WORK_DIR}/test/conf/app.ini
echo "[database]" >> ${WORK_DIR}/test/conf/app.ini
echo "DB_TYPE = sqlite3" >> ${WORK_DIR}/test/conf/app.ini
echo "LOG_SQL = false" >> ${WORK_DIR}/test/conf/app.ini
echo "[repository]" >> ${WORK_DIR}/test/conf/app.ini
echo "ROOT = ${WORK_DIR}/test/data/" >> ${WORK_DIR}/test/conf/app.ini
echo "[server]" >> ${WORK_DIR}/test/conf/app.ini
echo "ROOT_URL = http://127.0.0.1:3000" >> ${WORK_DIR}/test/conf/app.ini
echo "DISABLE_ROUTER_LOG=false" >> ${WORK_DIR}/test/conf/app.ini
echo "[log]" >> ${WORK_DIR}/test/conf/app.ini
echo "COLORIZE=false" >> ${WORK_DIR}/test/conf/app.ini
${WORK_DIR}/test/gitea-main migrate -c ${WORK_DIR}/test/conf/app.ini
${WORK_DIR}/test/gitea-main admin create-user --username=${GITEA_SDK_TEST_USERNAME} --password=${GITEA_SDK_TEST_PASSWORD} --email=test01@gitea.io --admin=true --must-change-password=false --access-token -c ${WORK_DIR}/test/conf/app.ini | grep "Access token" > .token
${WORK_DIR}/test/gitea-main web -c ${WORK_DIR}/test/conf/app.ini &
sleep 3