drone-tutorial-gitea-helper

module
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 5, 2022 License: Apache-2.0

README

Gitea API Helpers

A set of helpers to interact and configure Gitea using Gitea API. The helper also has set of Kubernetes jobs that could be used to configure the Gitea using Kubernetes jobs

NOTE: This is intended only for Demo purpose and currently developed to be used with Drone CI

Required tools

All linux distributions adds envsubst via gettext package. On macOS it can be installed using Homebrew like brew install gettext.

Clone the Sources

git clone https://github.com/kameshsampath/gitea-api-helper && \
  cd "$(basename "$_" .git)"
export GITEA_HELPER_HOME="${PWD}"

Build and Test locally

The following section details on how to build and test the helper locally.

Create Kubernetes Cluster
$GITEA_HELPER_HOME/bin/kind.sh
Deploy Gitea
helm repo add gitea-charts https://dl.gitea.io/charts/
helm repo update
helm upgrade \
  --install gitea gitea-charts/gitea \
  --values $GITEA_HELPER_HOME/helm_vars/gitea/values.yaml \
  --wait

Gitea service can be accessed using the url http://gitea-127.0.0.1.sslip.io:30950/

The default credentials is demo/demo@123

Setup Workshop
Kubernetes Cluster

Assuming you have,

  • Kubernetes Cluster with cluster-admin privileges
  • Gitea deployed and running

Create a kustomization file like

apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

namespace: drone
resources:
- https://raw.githubusercontent.com/kameshsampath/drone-tutorial-gitea-helper/main/manifests/install.yaml
## add your overrides

TIP: This can be useful if you want to override the workshop.yaml to suit your settings

Then do,

kubectl apply -k <your kustomize dir>
Locally

Create workshop config file like,

# The Gitea Configuration
giteaAdminUserName: demo
giteaAdminUserPassword: demo@123
giteaURL: http://gitea-127.0.0.1.sslip.io:30950/
users:
  # the lower bound of user e.g. user-01
  from: 1
  # the upper bound of user e.g. user-10
  to: 2
  # create Gitea oAuth app for user
  oAuthAppName: demo-oauth
  # oAuth redirect URL
  oAuthRedirectURI: https://drone-127.0.0.1.sslip.io:30980
  # add oAuth App ClientID and ClientSecret to Kubernetes Secret
  addKubernetesSecret: true
  # The Namespace where to create the secret, the secret will 
  # use the format demo-oauth-<username>-secret
  secretNamespace: default
  repos:
    - https://github.com/kameshsampath/jar-stack

Run the command,

go run cmd/main.go setup-workshop --workshop-file <path to the workshop config> -k <path to kubeconfig>

TODO: Release of binaries and kubernetes jobs to do this w/o manually running the command

Clean up

 kind delete cluster --name=gitea-dev

Directories

Path Synopsis
cmd
pkg

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL