MIGRATED TO https://codefloe.com/crow-plugins/plugin-lib Crow CI plugin library
This repository has been archived on 2026-01-18. You can view files and clone it, but you cannot make any changes to its state, such as pushing and creating new issues, pull requests or comments.
  • Go 97.9%
  • Just 2.1%
crowci-bot 6483723e2f
All checks were successful
ci/crow/push/changelog Pipeline was successful
ci/crow/push/lint Pipeline was successful
chore(deps): update pre-commit hook rbubley/mirrors-prettier to v3.8.0
2026-01-17 00:42:24 +00:00
.crow chore(deps): update codeberg.org/crow-plugins/clone docker tag to v1.0.3 2026-01-16 00:42:20 +00:00
.gitsv chore: add changelog workflow 2025-12-29 15:07:06 +01:00
cli feat: add custom cli flags (#48) 2025-04-23 18:01:11 +00:00
.editorconfig refactor: rebrand/refactor to Crow 2025-10-25 15:20:44 +02:00
.editorconfig-checker.json refactor: rebrand/refactor to Crow 2025-10-25 15:20:44 +02:00
.gitignore ci: add CGO support 2025-12-29 15:33:02 +01:00
.golangci.yaml chore: install golangci-lint binary, address lints 2025-12-29 15:23:30 +01:00
.markdownlint.yaml refactor: rebrand/refactor to Crow 2025-10-25 15:20:44 +02:00
.pre-commit-config.yaml chore(deps): update pre-commit hook rbubley/mirrors-prettier to v3.8.0 2026-01-17 00:42:24 +00:00
.prettierrc.json refactor: rebrand/refactor to Crow 2025-10-25 15:20:44 +02:00
.yamllint.yaml refactor: rebrand/refactor to Crow 2025-10-25 15:20:44 +02:00
commit.go refactor: rebrand/refactor to Crow 2025-10-25 15:20:44 +02:00
flags.go refactor: rebrand/refactor to Crow 2025-10-25 15:20:44 +02:00
forge.go refactor: rebrand/refactor to Crow 2025-10-25 15:20:44 +02:00
go.mod chore(deps): update dependency go to v1.25.6 2026-01-16 02:42:33 +00:00
go.sum chore(deps): update module golang.org/x/net to v0.49.0 2026-01-13 00:41:22 +00:00
http.go refactor: rebrand/refactor to Crow 2025-10-25 15:20:44 +02:00
Justfile refactor: rebrand/refactor to Crow 2025-10-25 15:20:44 +02:00
LICENSE refactor: rebrand/refactor to Crow 2025-10-25 15:20:44 +02:00
logger.go fix: return error from SetupConsoleLogger instead of calling log.Fatal 2025-12-29 16:17:52 +01:00
metadata.go feat: add IsPullRequest helper method to Metadata 2025-12-29 16:20:22 +01:00
metadata_test.go test: add tests for IsPullRequest and invalid pipeline files 2025-12-29 19:13:15 +01:00
pipeline.go fix: log warning instead of os.Exit on CI_PIPELINE_FILES parse failure 2025-12-29 16:18:40 +01:00
plugin.go feat: add Logger method to expose configured zerolog logger 2025-12-29 19:14:07 +01:00
plugin_test.go test: add tests for HTTPClient and Logger accessor methods 2025-12-29 19:15:24 +01:00
README.md chore: rename to plugin-lib 2025-10-25 15:57:05 +02:00
renovate.json ci: fix renovate config 2025-12-29 15:07:42 +01:00
repo.go refactor: rebrand/refactor to Crow 2025-10-25 15:20:44 +02:00
step.go refactor: rebrand/refactor to Crow 2025-10-25 15:20:44 +02:00
system.go refactor: rebrand/refactor to Crow 2025-10-25 15:20:44 +02:00

Library for creating Crow CI plugins

Provides basic structure and helpers to load Crow CI environment variables while also supporting reading Drone CI environment variables where available.

Adds logging support based on zerolog library and allows configurable HTTP client library.

Builtin settings

Settings Name Environment variable Default Description
log_level - info Sets log level (panic, fatal, error, warn, info, debug, trace)
skip_verify - false - Skip verification of TLS certificate
SOCKS_PROXY none SOCKS5 proxy to use for connections
SOCKS_PROXY_OFF none Do not use SOCKS5 proxy

Creating plugin

package main

import (
  "context"

  "codeberg.org/crow-plugins/plugin-lib"
  "github.com/rs/zerolog/log"
  "github.com/urfave/cli/v3"
)

type Settings struct {
  // TODO: Plugin settings
  SampleFlag string
}

type Plugin struct {
  *plugin.Plugin
  Settings *Settings
}

func (p *Plugin) Flags() []cli.Flag {
  return []cli.Flag{
    // TODO: Add flags
    &cli.StringFlag{
      Name:        "sample.flag",
      Usage:       "sample flag",
      Sources:     cli.EnvVars("PLUGIN_SAMPLE_FLAG"),
      Destination: &p.Settings.SampleFlag,
    },
  }
}

func (p *Plugin) Execute(ctx context.Context) error {
  // TODO: Implement execution
  log.Debug().Msg("executed")
  return nil
}

func main() {
  p := &Plugin{
    Settings: &Settings{},
  }

  p.Plugin = plugin.New(plugin.Options{
    Name:        "sample-plugin",
    Description: "Sample plugin",
    Flags:       p.Flags(),
    Execute:     p.Execute,
  })

  p.Run()
}