Giter Site home page Giter Site logo

drone-plugins / drone-gitea-release Goto Github PK

View Code? Open in Web Editor NEW
63.0 11.0 20.0 426 KB

Drone plugin for creating and tagging Gitea releases

Home Page: http://plugins.drone.io/drone-plugins/drone-gitea-release

License: Apache License 2.0

Go 100.00%
drone drone-plugin

drone-gitea-release's Introduction

drone-gitea-release

Build Status Gitter chat Join the discussion at https://discourse.drone.io Drone questions at https://stackoverflow.com Go Doc Go Report

Drone plugin to publish files and artifacts to Gitea release. For the usage information and a listing of the available options please take a look at the docs.

Build

Build the binary with the following command:

export GOOS=linux
export GOARCH=amd64
export CGO_ENABLED=0
export GO111MODULE=on

go build -v -a -tags netgo -o release/linux/amd64/drone-gitea-release

Docker

Build the Docker image with the following command:

docker build \
  --label org.label-schema.build-date=$(date -u +"%Y-%m-%dT%H:%M:%SZ") \
  --label org.label-schema.vcs-ref=$(git rev-parse --short HEAD) \
  --file docker/Dockerfile.linux.amd64 --tag plugins/gitea-release .

Usage

docker run --rm \
  -e PLUGIN_BASE_URL=https://try.gitea.io \
  -e PLUGIN_API_KEY=your-api-key \
  -e PLUGIN_FILES=build/* \
  -e DRONE_REPO_OWNER=gitea \
  -e DRONE_REPO_NAME=test \
  -e DRONE_BUILD_EVENT=tag \
  -v $(pwd):$(pwd) \
  -w $(pwd) \
  plugins/gitea-release

drone-gitea-release's People

Contributors

6543 avatar adrienverge avatar appleboy avatar awilliams avatar bradrydzewski avatar donny-dont avatar jackspirou avatar jonasfranz avatar kzaitsev avatar lunny avatar maplain avatar pheelee avatar renovate-bot avatar tboerger avatar thomasf avatar tonglil avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

drone-gitea-release's Issues

Glob support for ** using `mattn/go-zglob`

TLDR;

I'm trying to use drone-gitea-release to publish android builds to my Gitea instance, but it does not support ** glob pattern.

DETAILS

When I set the value of files to anything with **, it doesn't match the expected files even though ** is a standard glob pattern.

Example: the file android/app/build/outputs/bundle/experimentalPlayDebug/app-experimental-play-debug.aab cannot be matched with android/app/build/outputs/**/*.aab.

The name of the android build files can be different depending on some conditions, so it's not feasible to hard-code it as the value of the files option

POSSIBLE SOLUTION

After some digging, I discovered that filepath.Glob does not support ** Link to issue. mattn/go-zglob was recommended instead.

I would have loved to create a PR, but I have no experience in Golang

Failed to create release: unexpected end of JSON input

Release TAG not found
time="2018-05-23T17:32:48Z" level=fatal msg="Failed to create the release. Failed to retrieve or create a release: Failed to create release: unexpected end of JSON input"

I've looked through the issue but am not sure how to interpret this. What could lead to this error?

can't run in promotion

Hello everyone.

I'm using the gitea-release plugin in my pipeline.

When the steps are not promotion only, the pipeline works fine, the release was created and files uploaded. But when limiting it to run in promotion, I got this error:

msg="The Gitea Release plugin is only available for tags"

To avoid misunderstanding, this is what I've done to get this error.

  1. a tested working pipeline using gitea-release plugin (that the step has no trigger)
  2. add trigger to the step that using gitea-release plugin:
    when:
      event:
      - promote
  1. trigger the build with a tag push(git push origin --tags).
  2. promote the build.

step 1-3 works fine, step 4 got the error.

Content type error

Hello,

I'm trying to push some release to gitea, but I get the following error :
File type is not allowed
The file I've uploaded is a .tar.gz file, which is supposed to have the application/gzip mime type, and this type is in the default list of allowed type in gitea setting.

Any idea ?

Ability to create release without tag

It would be really appreciated if this plugin could create a release without a tag, but rather on a branch instead. So for example, if this plugin could create a release on pushing to a specific branch, it would make it easier to create releases on that specific branch.

Now I do understand that creating a release requires a tag, but perhaps this plugin could take that as a parameter (or maybe from a file?) and automatically create the tag? That would be very helpful.

The reason I'm requesting for this is because my current git flow is currently very redundant (or maybe I'm doing it wrong).

User pushes to develop branch, makes a PR to staging branch. Once it gets merged, drone pulls the branch (it's configured to only build for staging and master branch), build the application, and do nothing. Then, a tag is separately pushed to the staging branch (because tags cannot be a part of the PR, and I personally don't want anyone else to create a tag except for the approving authorities), then drone builds it again and then creates a release. I'd rather prefer it if it automatically builds the project once a push is made to a specific branch and a release is also created automatically.

Please help me understand a better git workflow in case I'm doing it wrong

Add documentation

This plugin is at the moment not listed at plugins.drone.io. So it would be nice to have a documentation at plugins.gitea.io.

Failed to fetch existing assets

I'm trying to push my build artifacts back into my Gitea 1.4.2 instance using the following configuration:

  release:
    image: plugins/gitea-release
    base_url: https://example.com
    secrets: [ gitea_token ]
    files:
      - target/x86_64-unknown-linux-musl/drone-test
    checksum:
      - md5
      - sha1
      - sha256
      - sha512
    when:
      event: tag

The new release is created, but before uploading the new assets, the plugin fails when trying to fetch the existing assets:
Failed to upload the files. Failed to fetch existing assets: 404 Not Found

Did the Gitea API change?

drone plugin not working on windows 2019 server

Note, I also posted this in the discourse group at : https://discourse.drone.io/t/gitea-release-plugin-on-windows-2019/9238

I'm not able to run the gitea release plugin for drone on windows 2019.

docker run --rm  plugins/gitea-release:1.0-windows-amd64
docker: Error response from daemon: hcsshim::CreateComputeSystem 44984ffc41fb3fe04fe8de525469a9cc02e4267aa8de82bec904fce
2b5b23d63: The container operating system does not match the host operating system.

I tried to build the plugin myself by adjusting the .drone.windows.yml file, but it already fails in the first step:

- name: vet
  pull: always
  image: golang:1.13-windowsservercore-1809
  commands:
  - go vet ./...
  environment:
    GO111MODULE: on
  volumes:
  - name: gopath
    path: C:\\gopath

but then I get


1 | 1.13-windowsservercore-1809: Pulling from library/golang
-- | --
1 | 1.13-windowsservercore-1809: Pulling from library/golang
1 | 1.13-windowsservercore-1809: Pulling from library/golang
2 | Digest: sha256:c592fdb70b31de6c83f3c9757ddd89d829b730d491226aa47bc5dbc7cc55369e
3 | Status: Downloaded newer image for golang:1.13-windowsservercore-1809
4 | + go vet ./...
5 | go: downloading code.gitea.io/sdk/gitea v0.13.2
6 | go: downloading github.com/joho/godotenv v1.3.0
7 | go: downloading github.com/sirupsen/logrus v1.7.0
8 | go: extracting code.gitea.io/sdk/gitea v0.13.2
9 | go: extracting github.com/sirupsen/logrus v1.7.0
10 | go: downloading github.com/urfave/cli v1.22.5
11 | go: extracting github.com/urfave/cli v1.22.5
12 | go: extracting github.com/joho/godotenv v1.3.0
13 | build github.com/drone-plugins/drone-gitea-release: cannot load code.gitea.io/sdk/gitea: rename C:\gopath\pkg\mod\code.gitea.io\sdk\[email protected] C:\gopath\pkg\mod\code.gitea.io\sdk\[email protected]: The system cannot find the path specified.

Missing support of checksum files

The plugin doesn't work if I add the checksum parameter to .drone.yml. The logs I added show that it's due to the .txt file for the checksum is not in the set of allowedTypes.

It's not a necessary parameter for me but I think having the issue open here can save others' time from diagnosing it.

Failed to create release: title is empty

Hello,
my colleagues and I use this plugin to upload generated pdf files compiled with latex in a release build. Since the upgrade of gitea to 1.13.0 we receive the following error: Failed to create release: title is empty.

More details

To release a version of a latex document we use in general the following git commands. For example to release a pdf document in version v0.1.0.

$ git tag -a v0.1.0 -m v0.1.0 
$ git push origin v0.1.0 

When the tag has been successfully pushed onto the git repository hosted on a gitea instance the following drone step will be started as one of others to push the release.

- name: push-tagged-gitea
  image: plugins/gitea-release
  settings:
    base_url: https://git.cryptic.systems
    api_key:
      from_secret: gitea_token
    files:
    - index.pdf
    checksum:
    - md5
    - sha1
    - sha256
    - sha512
    - adler32
    - crc32
  when:
    repo:
    - fh-trier/klinux_ws2021
    event:
    - tag

The step returns the following error:

Release v0.1.0 not found
time="2021-01-30T13:06:57Z" level=fatal msg="Failed to create the release. Failed to retrieve or create a release: Failed to create release: title is empty"

Now, why this does not work any more to release a compiled pdf document with the new version of gitea 13.0.0?

I tested additionally to release a new version over the web interface of gitea. There I must define a title for the release. I use v0.1.0 as title and the release step runs successfully. I'm kind of surprised that it works through the GUI but not through the CLI via git. Are we doing something wrong or is this the problem with the plugin?

Release successfully created, but build step failed.

Hi,

I'm using the gitea release module to push a release and its content to our gitea.

The module seems to successfully push the content to gitea, as you can see here:

screenshot from 2018-10-10 01-32-08

gitea_release log seems to be indicate that the release was ok, but as you can see here, the build step fails:
screenshot from 2018-10-10 01-30-40

The version of gitea used is 1.5.1, and the attachement mime types have been configured in the app.ini to allow tar.gz mime types.

Can't create release - 403 Forbidden

When trying to create a release, the plugin always shows:

level=fatal msg="403 Forbidden"

In the gitea log:

router: completed GET /api/v1/version for 192.168.80.2:0, 403 Forbidden in 2.9ms @ context/auth.go:113(context.ToggleAPI)

The secret is properly set in the UI.
The config:

  release:
    image: plugins/gitea-release
    environment:
      - DRONE_REPO_OWNER=${CI_REPO_OWNER}
      - DRONE_REPO_NAME=${CI_REPO_NAME}
      - DRONE_BUILD_EVENT=${CI_BUILD_EVENT}
      - DRONE_COMMIT_REF=${CI_COMMIT_REF}
    settings:
      api_key:
        - from_secrets: GITEA_API_KEY
      base_url: https://git.example.com
      files: dist/${CI_REPO_NAME}-${CI_COMMIT_TAG}.zip
      file_exists: fail
      prerelease: true
      title: ${CI_COMMIT_TAG}
    when:
      event: tag
      tag: v*

We already tried to add the GITEA_API_KEY to environment (as API_KEY, as well as PLUGIN_API_KEY) and add secrets: [GITEA_API_KEY] to the config.
Also we tried to using a public, user owned repository, instead of a private, organisation repository.

Any help is much appreciated!

Cheksums overwriting in single release when using multiple pipelines

Hi, thank you for such great integration!

However I noticed that when I have multiple pipelines (e.g. needed for multi-arch app with no cross-compile toolchain) like here, checksum filenames are same so it creates conflict on release (e.g gets overwritten).

It'd be great if was able to specify checksum name for every binary or it was automatically generated using filename like:

Filename: myapp-1.0.1-x86_64
Checksum Filename: myapp-1.0.1-x86_64-sha256.txt
(filename + separator + checksum type)

I've been searching drone docs, forum and didn't find anything like that.

Thanks in advance

x509: failed to load system roots and no roots provided

Hi,

to create a release on a gitea instance with custom certificates i have to use insecure: true to get it working. Why is the global env variable DRONE_VOLUME=/etc/pki/ca-trust/extracted/openssl/ca-bundle.trust.crt:/etc/ssl/certs/ca-certificates.crt not respected?

Default plugin/git works without adding insecure...

Failed to upload files

like #7

Releases created successfully, but attachments cannot be uploaded.

Got Failed to upload the files. Failed to upload xxx artifact: invalid character '<' looking for beginning of value

Gitea app.ini

APP_NAME = Gitea
RUN_USER = git
RUN_MODE = prod

[database]
DB_TYPE  = sqlite3
HOST     = 127.0.0.1:3306
NAME     = gogs
USER     = root
PASSWD   =
SSL_MODE = disable
PATH     = data/gitea.db

[repository]
ROOT = /var/data/gitea/repositories

[server]
DOMAIN           = *REMOVED*
HTTP_PORT        = 3000
ROOT_URL         = *REMOVED*
DISABLE_SSH      = false
SSH_PORT         = 22
SSH_LISTEN_PORT  = 2222
START_SSH_SERVER = true
OFFLINE_MODE     = false

[service]
REGISTER_EMAIL_CONFIRM = false
ENABLE_NOTIFY_MAIL     = false
DISABLE_REGISTRATION   = true
ENABLE_CAPTCHA         = false
REQUIRE_SIGNIN_VIEW    = true

[picture]
DISABLE_GRAVATAR        = false
ENABLE_FEDERATED_AVATAR = false

[session]
PROVIDER = file

[attachment]
ALLOWED_TYPES = */*
MAX_SIZE = 4096

[log]
MODE      = file
LEVEL     = INFO
ROOT_PATH = /var/data/gitea/log

[security]
INSTALL_LOCK   = true
SECRET_KEY     = *REMOVED*
INTERNAL_TOKEN = *REMOVED*
[oauth2]
JWT_SECRET = *REMOVED*

You must provide an API key

    image: plugins/gitea-release
    settings:
        base_url: http://gidro.westeurope.cloudapp.azure.com:3000
        api_key:
          from_secret: gitea_token
        files: .*.tar.gz
    checksum:
        - md5
        - sha1
        - sha256
        - sha512
        - adler32
        - crc32
    when:
        event: tag

not working?
image

compose file

version: "3.7"


services:
  gitea:
    image: gitea/gitea:latest
    environment:
      - USER_UID=1000
      - USER_GID=1000
    restart: always
    networks:
      - gitea
    volumes:
      - ./gitea:/data
    ports:
      - "3000:3000"
      - "222:22"
  drone-server:
    image: drone/drone:1
    container_name: drone_server
    networks:
      - dronenet
    ports:
      - "8080:80"
      - "8443:443"
    volumes:
      - /var/lib/drone:/data
      - /var/run/docker.sock:/var/run/docker.sock
    restart: always
    environment:
      - DRONE_GITEA_SERVER=http://gitea:3000
      - DRONE_GIT_ALWAYS_AUTH=false
      - DRONE_RUNNER_CAPACITY=2
      - DRONE_SERVER_PROTO=http 
      - DRONE_SERVER_HOST=gidro.westeurope.cloudapp.azure.com:8080
      - DRONE_TLS_AUTOCERT=false 

networks:
  dronenet:

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.