Codeberg-CI/feedback
490
71

Release failure: invalid header field value for "Authorization" during publish step #293

Open
opened 2025年12月21日 00:18:42 +01:00 by batyrmuhadov · 8 comments

The build step completes successfully; however, the release step is failing

Error Log

ERR execution failed error="Get \"https://codeberg.org/api/v1/version\": net/http: invalid header field value for \"Authorization\""

Workflow file

publish:image:woodpeckerci/plugin-releasesettings:files:- 'ocean-*.tar.xz'api_key:from_secret:codeberg_tokenwhen:branch:masterevent:tag
**The build step completes successfully; however, the release step is failing** ### **Error Log** `ERR execution failed error="Get \"https://codeberg.org/api/v1/version\": net/http: invalid header field value for \"Authorization\""` ### **Workflow file** ```yaml publish: image: woodpeckerci/plugin-release settings: files: - 'ocean-*.tar.xz' api_key: from_secret: codeberg_token when: branch: master event: tag

In which CI pipeline are you seeing this problem?

In which CI pipeline are you seeing this problem?
Author
Member
Copy link

.woodpecker.yaml

steps:build:image:rust:1.82-bullseyeenvironment:RUST_BACKTRACE:"1"commands:- apt-get update -y && apt-get install -y xz-utils pkg-config libssl-dev- cargo run --package=helix-loader --bin=hx-loader -- fetch- cargo run --package=helix-loader --bin=hx-loader -- build- cargo build --profile opt --locked- mkdir -p dist && cp target/opt/hx dist/ && cp -r runtime dist/- rm -rf dist/runtime/grammars/sources- tar cJf helix-$(date -u +%Y-%m-%d)-x86_64-linux.tar.xz -C dist . - ls -lh helix-*.tar.xzwhen:event:- push- tagpublish:image:woodpeckerci/plugin-releasesettings:files:- 'helix-*.tar.xz'api_key:from_secret:woodpecker_tokendepends_on:- buildwhen:event:tag
### .woodpecker.yaml ```yaml steps: build: image: rust:1.82-bullseye environment: RUST_BACKTRACE: "1" commands: - apt-get update -y && apt-get install -y xz-utils pkg-config libssl-dev - cargo run --package=helix-loader --bin=hx-loader -- fetch - cargo run --package=helix-loader --bin=hx-loader -- build - cargo build --profile opt --locked - mkdir -p dist && cp target/opt/hx dist/ && cp -r runtime dist/ - rm -rf dist/runtime/grammars/sources - tar cJf helix-$(date -u +%Y-%m-%d)-x86_64-linux.tar.xz -C dist . - ls -lh helix-*.tar.xz when: event: - push - tag publish: image: woodpeckerci/plugin-release settings: files: - 'helix-*.tar.xz' api_key: from_secret: woodpecker_token depends_on: - build when: event: tag ```

https://ci.codeberg.org/repos/15710/pipeline/52/3 to me it looks like the pipeline was successful? Was the error you saw from locally running this workflow?

https://ci.codeberg.org/repos/15710/pipeline/52/3 to me it looks like the pipeline was successful? Was the error you saw from locally running this workflow?
Author
Member
Copy link

Yes, as I said build completes, but release fails. https://ci.codeberg.org/repos/15710/pipeline/54/4 And no I don't run it locally.

Yes, as I said build completes, but release fails. https://ci.codeberg.org/repos/15710/pipeline/54/4 And no I don't run it locally.

Are you sure about your token? Maybe it needs to be token 5273afe22...?

Are you sure about your token? Maybe it needs to be `token 5273afe22...`?
Author
Member
Copy link

@mahlzahn wrote in #293 (comment):

Are you sure about your token? Maybe it needs to be token 5273afe22...?

I am not sure that's the issue. I initially suspected the token as well and tried updating it, but the problem persists. Or am I doing something wrong?

@mahlzahn wrote in https://codeberg.org/Codeberg-CI/feedback/issues/293#issuecomment-9136866: > Are you sure about your token? Maybe it needs to be `token 5273afe22...`? I am not sure that's the issue. I initially suspected the token as well and tried updating it, but the problem persists. Or am I doing something wrong?
Owner
Copy link

this code reads the token:

Sources:cli.EnvVars("PLUGIN_API_KEY"),
Destination:&p.Settings.APIKey,

that is used the forgejo client to do stuff:

forgejo,err:=forge.NewForgejo(ctx,p.Settings.BaseURL,p.Settings.APIKey,p.HTTPClient())

that is directly passed through to the forgejo sdk

client,err:=forgejo.NewClient(baseURL,forgejo.SetToken(apiKey),forgejo.SetHTTPClient(httpClient),forgejo.SetContext(ctx))

so the plugin itselfe does not conversion/handeling of the token

so i suspect an forgejo sdk bug or forgejo bug

this code reads the token: https://codeberg.org/woodpecker-plugins/release/src/commit/0295fa984c8fe7a1b907b173237bc65a086b95d4/flags.go#L24-L25 that is used the forgejo client to do stuff: https://codeberg.org/woodpecker-plugins/release/src/commit/0295fa984c8fe7a1b907b173237bc65a086b95d4/impl.go#L104 that is directly passed through to the forgejo sdk https://codeberg.org/woodpecker-plugins/release/src/commit/0295fa984c8fe7a1b907b173237bc65a086b95d4/forge/forgejo.go#L29 so the plugin itselfe does not conversion/handeling of the token so i suspect an forgejo sdk bug or forgejo bug
Owner
Copy link
funcSetToken(tokenstring)ClientOption{
returnfunc(client*Client)error{
client.mutex.Lock()
client.accessToken=token
client.mutex.Unlock()
returnnil
}
}
iflen(c.accessToken)!=0{
req.Header.Set("Authorization","token "+c.accessToken)
}

as per forgejo swagger
image

that's correct so the problem must be the token itselve

https://codeberg.org/mvdkleijn/forgejo-sdk/src/commit/5f3afea2faac9b9b33bc78eebc7a6d1778f6bed2/forgejo/client.go#L113-L120 https://codeberg.org/mvdkleijn/forgejo-sdk/src/commit/5f3afea2faac9b9b33bc78eebc7a6d1778f6bed2/forgejo/client.go#L350-L352 as per forgejo swagger ![image](/attachments/b3625273-16eb-483b-8287-8c9d5f7e808d) that's correct so the problem must be the token itselve
Sign in to join this conversation.
No Branch/Tag specified
main
No results found.
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
4 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Codeberg-CI/feedback#293
Reference in a new issue
Codeberg-CI/feedback
No description provided.
Delete branch "%!s()"

Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?