Compare commits

..

No commits in common. "344589829b69a204368bbb6c90ec4a10fc1b1944" and "0fc6a4b093b4898d48890384176b144eba4eafe9" have entirely different histories.

17 changed files with 145 additions and 86 deletions

View file

@ -1,21 +0,0 @@
on:
push:
branches:
- "main"
jobs:
docker-build-push:
runs-on: cth-ubuntu-latest
steps:
- name: set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: login to repository
uses: docker/login-action@v3
with:
registry: git.faercol.me
username: ${{ secrets.DOCKER_LOGIN }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: build and push image
uses: docker/build-push-action@v6
with:
push: true
tags: git.faercol.me/polyculeconnect/polyculeconnect:latest

View file

@ -1,21 +0,0 @@
on:
push:
tags:
- "**"
jobs:
docker-build-push:
runs-on: cth-ubuntu-latest
steps:
- name: set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: login to repository
uses: docker/login-action@v3
with:
registry: git.faercol.me
username: ${{ secrets.DOCKER_LOGIN }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: build and push image
uses: docker/build-push-action@v6
with:
push: true
tags: git.faercol.me/polyculeconnect/polyculeconnect:${{ gitea.ref_name }}

View file

@ -1,16 +0,0 @@
on:
push:
branches:
- "**"
- "!main"
jobs:
docker-build-only:
runs-on: cth-ubuntu-latest
steps:
- name: set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: build image (build only)
uses: docker/build-push-action@v6
with:
push: false
tags: git.faercol.me/polyculeconnect/polyculeconnect

View file

@ -1,17 +0,0 @@
on:
push:
branches:
- "**"
jobs:
go-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: 1.22
- name: Run unit tests
run: make -C polyculeconnect test
- name: Build go package
run: make -C polyculeconnect build

57
.woodpecker/deploy.yml Normal file
View file

@ -0,0 +1,57 @@
steps:
docker-build-only:
image: woodpeckerci/plugin-docker-buildx
privileged: true
settings:
repo: git.faercol.me/polyculeconnect/polyculeconnect
tags: latest
dry_run: true
platforms:
- linux/amd64
# - linux/arm64
when:
- event: pull_request
- event: push
branch:
exclude: [main]
docker-build-push:
image: woodpeckerci/plugin-docker-buildx
privileged: true
settings:
repo: git.faercol.me/polyculeconnect/polyculeconnect
registry: git.faercol.me
tags: latest
username:
from_secret: git_username
password:
from_secret: git_password
platforms:
- linux/amd64
# - linux/arm64
when:
- event: push
branch: main
docker-push-tag:
image: woodpeckerci/plugin-docker-buildx
privileged: true
settings:
registry: git.faercol.me
repo: git.faercol.me/polyculeconnect/polyculeconnect
auto_tag: true
platforms:
- linux/amd64
# - linux/arm64
username:
from_secret: git_username
password:
from_secret: git_password
when:
- event: tag
depends_on:
- test
when:
event: [push, tag]

13
.woodpecker/test.yml Normal file
View file

@ -0,0 +1,13 @@
steps:
go-test:
image: golang
commands:
- make -C polyculeconnect test
go-build:
image: golang
commands:
- make -C polyculeconnect build
when:
event: [push, tag]

View file

@ -1,6 +1,7 @@
# PolyculeConnect # PolyculeConnect
[![status-badge](https://git.faercol.me/PolyculeConnect/polycule-connect/badges/workflows/go-test.yml/badge.svg?branch=main)](https://ci-polycule-connect.chapoline.me/repos/1) [![status-badge](https://ci-polycule-connect.chapoline.me/api/badges/1/status.svg)](https://ci-polycule-connect.chapoline.me/repos/1)
[![status-badge](https://ci-server.internal.faercol.me/api/badges/2/status.svg)](https://ci-server.internal.faercol.me/repos/2)
![Project logo](./polyculeconnect/static/img/logo-text.png) ![Project logo](./polyculeconnect/static/img/logo-text.png)

View file

@ -13,8 +13,10 @@ import (
var appRemoveCmd = &cobra.Command{ var appRemoveCmd = &cobra.Command{
Use: "remove <app_client_id>", Use: "remove <app_client_id>",
Short: "Remove an app", Short: "Remove an app",
Long: `Remove the app with the given ID from the database.`, Long: `Remove the app with the given ID from the database.
Args: cobra.ExactArgs(1),
If the app is not found in the database, no error is returned`,
Args: cobra.ExactArgs(1),
Run: func(cmd *cobra.Command, args []string) { Run: func(cmd *cobra.Command, args []string) {
removeApp(args[0]) removeApp(args[0])
}, },

View file

@ -15,8 +15,8 @@ var appShowCmd = &cobra.Command{
Short: "Display installed apps", Short: "Display installed apps",
Long: `Display the configuration for the apps. Long: `Display the configuration for the apps.
Optional parameters: Pass the commands without arguments to display the list of currently installed apps
- app-id: id of the application to display. If empty, display the list of available apps instead`, Pass the optional 'id' argument to display the configuration for this specific app`,
Args: cobra.MaximumNArgs(1), Args: cobra.MaximumNArgs(1),
Run: func(cmd *cobra.Command, args []string) { Run: func(cmd *cobra.Command, args []string) {
s := utils.InitStorage(utils.InitConfig("")) s := utils.InitStorage(utils.InitConfig(""))

View file

@ -9,8 +9,13 @@ import (
var backendCmd = &cobra.Command{ var backendCmd = &cobra.Command{
Use: "backend", Use: "backend",
Short: "Handle authentication backends", Short: "A brief description of your command",
Long: `Add, Remove or Show currently installed authentication backends`, Long: `A longer description that spans multiple lines and likely contains examples
and usage of using your command. For example:
Cobra is a CLI library for Go that empowers applications.
This application is a tool to generate the needed files
to quickly create a Cobra application.`,
Run: func(cmd *cobra.Command, args []string) { Run: func(cmd *cobra.Command, args []string) {
fmt.Println("backend called") fmt.Println("backend called")
}, },

View file

@ -13,8 +13,10 @@ import (
var backendRemoveCmd = &cobra.Command{ var backendRemoveCmd = &cobra.Command{
Use: "remove <backend_id>", Use: "remove <backend_id>",
Short: "Remove a backend", Short: "Remove a backend",
Long: `Remove the backend with the given ID from the database.`, Long: `Remove the backend with the given ID from the database.
Args: cobra.ExactArgs(1),
If the backend is not found in the database, no error is returned`,
Args: cobra.ExactArgs(1),
Run: func(cmd *cobra.Command, args []string) { Run: func(cmd *cobra.Command, args []string) {
removeBackend(args[0]) removeBackend(args[0])
}, },

View file

@ -15,8 +15,8 @@ var backendShowCmd = &cobra.Command{
Short: "Display installed backends", Short: "Display installed backends",
Long: `Display the configuration for the backends. Long: `Display the configuration for the backends.
Optional parameters: Pass the commands without arguments to display the list of currently installed backends
- app-id: id of the backend to display. If empty, display the list of available backends instead`, Pass the optional 'id' argument to display the configuration for this specific backend`,
Args: cobra.MaximumNArgs(1), Args: cobra.MaximumNArgs(1),
Run: func(cmd *cobra.Command, args []string) { Run: func(cmd *cobra.Command, args []string) {
s := utils.InitStorage(utils.InitConfig("")) s := utils.InitStorage(utils.InitConfig(""))

View file

@ -52,4 +52,14 @@ func connectToDB(conf *config.AppConfig) error {
func init() { func init() {
dbCmd.AddCommand(connectCmd) dbCmd.AddCommand(connectCmd)
// Here you will define your flags and configuration settings.
// Cobra supports Persistent Flags which will work for this command
// and all subcommands, e.g.:
// dbCmd.PersistentFlags().String("foo", "", "A help for foo")
// Cobra supports local flags which will only run when this command
// is called directly, e.g.:
// dbCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle")
} }

View file

@ -14,4 +14,14 @@ var dbCmd = &cobra.Command{
func init() { func init() {
cmd.RootCmd.AddCommand(dbCmd) cmd.RootCmd.AddCommand(dbCmd)
// Here you will define your flags and configuration settings.
// Cobra supports Persistent Flags which will work for this command
// and all subcommands, e.g.:
// dbCmd.PersistentFlags().String("foo", "", "A help for foo")
// Cobra supports local flags which will only run when this command
// is called directly, e.g.:
// dbCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle")
} }

View file

@ -47,4 +47,14 @@ func deleteDB(conf *config.AppConfig) error {
func init() { func init() {
dbCmd.AddCommand(destroyCmd) dbCmd.AddCommand(destroyCmd)
// Here you will define your flags and configuration settings.
// Cobra supports Persistent Flags which will work for this command
// and all subcommands, e.g.:
// dbCmd.PersistentFlags().String("foo", "", "A help for foo")
// Cobra supports local flags which will only run when this command
// is called directly, e.g.:
// dbCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle")
} }

View file

@ -12,6 +12,9 @@ var RootCmd = &cobra.Command{
Short: "You're in their DMs, I'm in their SSO", Short: "You're in their DMs, I'm in their SSO",
Long: `PolyculeConnect is a SSO OpenIDConnect provider which allows multiple authentication backends, Long: `PolyculeConnect is a SSO OpenIDConnect provider which allows multiple authentication backends,
and enables authentication federation among several infrastructures.`, and enables authentication federation among several infrastructures.`,
// Uncomment the following line if your bare application
// has an action associated with it:
// Run: func(cmd *cobra.Command, args []string) { },
} }
// Execute adds all child commands to the root command and sets flags appropriately. // Execute adds all child commands to the root command and sets flags appropriately.
@ -24,5 +27,16 @@ func Execute() {
} }
func init() { func init() {
// Here you will define your flags and configuration settings.
// Cobra supports persistent flags, which, if defined here,
// will be global for your application.
// rootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file (default is $HOME/.polyculeconnect.yaml)")
// Cobra also supports local flags, which will only run
// when this action is called directly.
// rootCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle")
// Disable the default `completion` command to generate the autocompletion files
RootCmd.Root().CompletionOptions.DisableDefaultCmd = true RootCmd.Root().CompletionOptions.DisableDefaultCmd = true
} }

View file

@ -113,5 +113,15 @@ func serve() {
func init() { func init() {
cmd.RootCmd.AddCommand(serveCmd) cmd.RootCmd.AddCommand(serveCmd)
// Here you will define your flags and configuration settings.
// Cobra supports Persistent Flags which will work for this command
// and all subcommands, e.g.:
// serveCmd.PersistentFlags().String("foo", "", "A help for foo")
// Cobra supports local flags which will only run when this command
// is called directly, e.g.:
// serveCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle")
serveCmd.Flags().StringVarP(&configPath, "config", "c", "config.json", "Path to the JSON configuration file") serveCmd.Flags().StringVarP(&configPath, "config", "c", "config.json", "Path to the JSON configuration file")
} }