[opensuse-buildservice] Release trigger via token behaves differently than releasing via osc.

Hi all, I'm running obs 2.10 in a private instance. I have a problem with releasing binaries via token. My setup is: Project Foo-Cloud:testing with a setup like <project name="Foo-Cloud:testing"> <title>Foo-Cloud testing</title> <description>All package updates get tested here before submitting tobasic prj</description> <person userid="seife" role="bugowner"/> <person userid="seife" role="maintainer"/> <debuginfo> <enable/> </debuginfo> <repository name="SLES15"> <releasetarget project="Foo-Cloud" repository="SLES15" trigger="manual"/> <path project="Foo-Cloud" repository="SLES15"/> <arch>x86_64</arch> </repository> <repository name="SLES12-SP1"> <path project="SLES12-SP1" repository="standard"/> <arch>x86_64</arch> </repository> <repository name="SLES12"> <releasetarget project="Foo-Cloud" repository="SLES12" trigger="manual"/> <path project="Foo-Cloud" repository="SLES12"/> <arch>x86_64</arch> </repository> <repository name="SLES11-SP4"> <releasetarget project="Foo-Cloud" repository="SLES11-SP4" trigger="manual"/> <path project="Foo-Cloud" repository="SLES11-SP4"/> <path project="devel_languages:go" repository="SLES11-SP3"/> <arch>x86_64</arch> </repository> <repository name="SLES11-SP3"> <releasetarget project="Foo-Cloud" repository="SLES11-SP3" trigger="manual"/> <path project="Foo-Cloud" repository="SLES11-SP3"/> <arch>x86_64</arch> </repository> <repository name="SLES11-SP2"> <releasetarget project="Foo-Cloud" repository="SLES11-SP2" trigger="manual"/> <path project="Foo-Cloud" repository="SLES11-SP2"/> <arch>x86_64</arch> </repository> <repository name="SLES11-SP1"> <releasetarget project="Foo-Cloud" repository="SLES11-SP1" trigger="manual"/> <path project="Foo-Cloud" repository="SLES11-SP1"/> <arch>x86_64</arch> </repository> </project> "Foo-Cloud" is similar. The package looks like: <package name="foo-api-reference-client" project="Foo-Cloud:testing"> <title>foo-api-reference-client</title> <description>Will be released via "osc release" to Foo-Cloud!</description> <person userid="service_trigger" role="maintainer"/> </package> The package in Foo-Cloud: <package name="foo-api-reference-client" project="Foo-Cloud"> <title>foo-api-reference-client</title> <description>Will be released via "osc release" to Foo-Cloud!</description> <person userid="service_trigger" role="maintainer"/> <build> <disable/> </build> </package> (I'm just transitioning from "build(testing)->submitrequrest->build" to "build and release via token") The tokens of user service_trigger look like: <directory count="2"> <entry id="94" string="FQ2dYeUS1VQSR7VQgnWE9iMa" kind="runservice" project="Foo-Cloud:testing" package="foo-api-reference-client"/> <entry id="95" string="oFzZnPriT4SKZiArh5vnaqpT" kind="release" project="Foo-Cloud:testing" package="foo-api-reference-client"/> </directory> Build is triggered via OBS_TOKEN_RUN=FQ2dYeUS1VQSR7VQgnWE9iMa curl -f -X POST -H "Content-Type: application/octet-stream" -H "Authorization: Token $OBS_TOKEN_RUN" https://obs/trigger/runservice This works well. Release is the same: OBS_TOKEN_REL=oFzZnPriT4SKZiArh5vnaqpT curl -f -X POST -H "Content-Type: application/octet-stream" -H "Authorization: Token $OBS_TOKEN_REL" https://obs/trigger/release However, this triggers only the release of one repository, SLES11-SP1, and then stops. If I run "osc release" as the service_trigger user, then it works fine and all repos are released. I'm lookint ath the "matched_repo?" function in src/api/app/controllers/trigger_controller.rb, wondering if it is doing everything correctly, but I don't grok enough ruby on rails to judge ;-) Any hints? Best regards, seife -- Stefan Seyfried "For a successful technology, reality must take precedence over public relations, for nature cannot be fooled." -- Richard Feynman -- To unsubscribe, e-mail: opensuse-buildservice+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-buildservice+owner@opensuse.org

<releasetarget project="Foo-Cloud" repository="SLES12" trigger="manual"/> ... see > trigger=manual thus release of this target is only by manual (osc release ...) run On Tue, 14 Jan 2020 at 12:26, Stefan Seyfried <stefan.seyfried@googlemail.com> wrote:
Hi all,
I'm running obs 2.10 in a private instance. I have a problem with releasing binaries via token.
My setup is: Project Foo-Cloud:testing with a setup like
<project name="Foo-Cloud:testing"> <title>Foo-Cloud testing</title> <description>All package updates get tested here before submitting tobasic prj</description> <person userid="seife" role="bugowner"/> <person userid="seife" role="maintainer"/> <debuginfo> <enable/> </debuginfo> <repository name="SLES15"> <releasetarget project="Foo-Cloud" repository="SLES15" trigger="manual"/> <path project="Foo-Cloud" repository="SLES15"/> <arch>x86_64</arch> </repository> <repository name="SLES12-SP1"> <path project="SLES12-SP1" repository="standard"/> <arch>x86_64</arch> </repository> <repository name="SLES12"> <releasetarget project="Foo-Cloud" repository="SLES12" trigger="manual"/> <path project="Foo-Cloud" repository="SLES12"/> <arch>x86_64</arch> </repository> <repository name="SLES11-SP4"> <releasetarget project="Foo-Cloud" repository="SLES11-SP4" trigger="manual"/> <path project="Foo-Cloud" repository="SLES11-SP4"/> <path project="devel_languages:go" repository="SLES11-SP3"/> <arch>x86_64</arch> </repository> <repository name="SLES11-SP3"> <releasetarget project="Foo-Cloud" repository="SLES11-SP3" trigger="manual"/> <path project="Foo-Cloud" repository="SLES11-SP3"/> <arch>x86_64</arch> </repository> <repository name="SLES11-SP2"> <releasetarget project="Foo-Cloud" repository="SLES11-SP2" trigger="manual"/> <path project="Foo-Cloud" repository="SLES11-SP2"/> <arch>x86_64</arch> </repository> <repository name="SLES11-SP1"> <releasetarget project="Foo-Cloud" repository="SLES11-SP1" trigger="manual"/> <path project="Foo-Cloud" repository="SLES11-SP1"/> <arch>x86_64</arch> </repository> </project>
"Foo-Cloud" is similar.
The package looks like: <package name="foo-api-reference-client" project="Foo-Cloud:testing"> <title>foo-api-reference-client</title> <description>Will be released via "osc release" to Foo-Cloud!</description> <person userid="service_trigger" role="maintainer"/> </package>
The package in Foo-Cloud: <package name="foo-api-reference-client" project="Foo-Cloud"> <title>foo-api-reference-client</title> <description>Will be released via "osc release" to Foo-Cloud!</description> <person userid="service_trigger" role="maintainer"/> <build> <disable/> </build> </package>
(I'm just transitioning from "build(testing)->submitrequrest->build" to "build and release via token")
The tokens of user service_trigger look like: <directory count="2"> <entry id="94" string="FQ2dYeUS1VQSR7VQgnWE9iMa" kind="runservice" project="Foo-Cloud:testing" package="foo-api-reference-client"/> <entry id="95" string="oFzZnPriT4SKZiArh5vnaqpT" kind="release" project="Foo-Cloud:testing" package="foo-api-reference-client"/> </directory>
Build is triggered via OBS_TOKEN_RUN=FQ2dYeUS1VQSR7VQgnWE9iMa curl -f -X POST -H "Content-Type: application/octet-stream" -H "Authorization: Token $OBS_TOKEN_RUN" https://obs/trigger/runservice
This works well.
Release is the same: OBS_TOKEN_REL=oFzZnPriT4SKZiArh5vnaqpT curl -f -X POST -H "Content-Type: application/octet-stream" -H "Authorization: Token $OBS_TOKEN_REL" https://obs/trigger/release
However, this triggers only the release of one repository, SLES11-SP1, and then stops.
If I run "osc release" as the service_trigger user, then it works fine and all repos are released.
I'm lookint ath the "matched_repo?" function in src/api/app/controllers/trigger_controller.rb, wondering if it is doing everything correctly, but I don't grok enough ruby on rails to judge ;-)
Any hints?
Best regards,
seife -- Stefan Seyfried
"For a successful technology, reality must take precedence over public relations, for nature cannot be fooled." -- Richard Feynman -- To unsubscribe, e-mail: opensuse-buildservice+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-buildservice+owner@opensuse.org
-- To unsubscribe, e-mail: opensuse-buildservice+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-buildservice+owner@opensuse.org

Am 14.01.20 um 13:19 schrieb Ondřej Súkup:
<releasetarget project="Foo-Cloud" repository="SLES12" trigger="manual"/> ... see > trigger=manual
thus release of this target is only by manual (osc release ...) run
the trigger token should do the same as "osc release", shouldn't it? The SLES11-SP1 repo has also "trigger=manual", but it is released... I'd say the "matched_repo?" function in src/api/app/controllers/trigger_controller.rb is broken, trying to debug now...
<project name="Foo-Cloud:testing"> <title>Foo-Cloud testing</title> <description>All package updates get tested here before submitting tobasic prj</description> <person userid="seife" role="bugowner"/> <person userid="seife" role="maintainer"/> <debuginfo> <enable/> </debuginfo>
<repository name="SLES11-SP1"> <releasetarget project="Foo-Cloud" repository="SLES11-SP1" trigger="manual"/> <path project="Foo-Cloud" repository="SLES11-SP1"/> <arch>x86_64</arch> </repository> </project> -- Stefan Seyfried
"For a successful technology, reality must take precedence over public relations, for nature cannot be fooled." -- Richard Feynman -- To unsubscribe, e-mail: opensuse-buildservice+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-buildservice+owner@opensuse.org

Am 14.01.20 um 13:45 schrieb Stefan Seyfried:
I'd say the "matched_repo?" function in src/api/app/controllers/trigger_controller.rb is broken, trying to debug now...
fix: --- a/src/api/app/controllers/trigger_controller.rb +++ b/src/api/app/controllers/trigger_controller.rb @@ -28,7 +28,12 @@ class TriggerController < ApplicationController def release raise NoPermissionForPackage.setup('no_permission', 403, "no permission for package #{@pkg} in project #{@pkg.project}") unless policy(@pkg).update? - matched_repo = @pkg.project.repositories.includes(:release_targets).any? { |repo| matched_repo?(repo) } + matched_repo = FALSE + @pkg.project.repositories.includes(:release_targets).each do |repo| + if matched_repo?(repo) then + matched_repo = TRUE + end + end ".any?" will return after first successful release 🤦 Pullrequest is on its way. -- Stefan Seyfried "For a successful technology, reality must take precedence over public relations, for nature cannot be fooled." -- Richard Feynman -- To unsubscribe, e-mail: opensuse-buildservice+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-buildservice+owner@opensuse.org
participants (2)
-
Ondřej Súkup
-
Stefan Seyfried