Monorepo for Tangled tangled.org

lexicons,appview,spindle: add workflow cancel #889

merged opened by boltless.me targeting master from sl/okmkyytolvko
Labels

None yet.

assignee

None yet.

Participants 2
AT URI
at://did:plc:xasnlahkri4ewmbuzly2rlc5/sh.tangled.repo.pull/3m7zmleup7g22
+6 -4
Interdiff #3 โ†’ #4
api/tangled/pipelinecancelPipeline.go

This file has not been changed.

+2 -1
appview/pages/templates/repo/pipelines/workflow.html
··· 14 <div class="col-span-1 md:col-span-3"> 15 <!-- TODO(boltless): explictly check for pipeline cancel permission --> 16 {{ if $.RepoInfo.Roles.IsOwner }} 17 - <div class="flex justify-end mb-2"> 18 <button 19 class="btn" 20 hx-post="/{{ $.RepoInfo.FullName }}/pipelines/{{ .Pipeline.Id }}/workflow/{{ .Workflow }}/cancel"
··· 14 <div class="col-span-1 md:col-span-3"> 15 <!-- TODO(boltless): explictly check for pipeline cancel permission --> 16 {{ if $.RepoInfo.Roles.IsOwner }} 17 + <div class="flex justify-between mb-2"> 18 + <div id="workflow-error" class="text-red-500 dark:text-red-400"></div> 19 <button 20 class="btn" 21 hx-post="/{{ $.RepoInfo.FullName }}/pipelines/{{ .Pipeline.Id }}/workflow/{{ .Workflow }}/cancel"
+4 -3
appview/pipelines/pipelines.go
··· 391 Workflow: workflow, 392 }, 393 ) 394 - errorId := "pipeline-action" 395 if err != nil { 396 - l.Error("failed to cancel pipeline", "err", err) 397 - p.pages.Notice(w, errorId, "Failed to cancel pipeline") 398 return 399 } 400 l.Debug("canceled pipeline", "uri", pipeline.AtUri())
··· 391 Workflow: workflow, 392 }, 393 ) 394 + err = fmt.Errorf("boo! new error") 395 + errorId := "workflow-error" 396 if err != nil { 397 + l.Error("failed to cancel workflow", "err", err) 398 + p.pages.Notice(w, errorId, "Failed to cancel workflow") 399 return 400 } 401 l.Debug("canceled pipeline", "uri", pipeline.AtUri())
appview/state/router.go

This file has not been changed.

lexicons/pipeline/cancelPipeline.json

This file has not been changed.

spindle/db/events.go

This file has not been changed.

spindle/server.go

This file has not been changed.

spindle/xrpc/pipeline_cancelPipeline.go

This file has not been changed.

spindle/xrpc/xrpc.go

This file has not been changed.

History

7 rounds 7 comments
sign up or login to add to the discussion
1 commit
expand
lexicons,appview,spindle: add workflow cancel
expand 0 comments
pull request successfully merged
1 commit
expand
lexicons,appview,spindle: add workflow cancel
expand 1 comment
  • here, failedis spelled asdailed`
  • here, err := fmt.Errorf(...) should probably be removed.
1 commit
expand
lexicons,appview,spindle: add workflow cancel
expand 0 comments
1 commit
expand
lexicons,appview,spindle: add workflow cancel
expand 0 comments
1 commit
expand
lexicons,appview,spindle: add workflow cancel
expand 0 comments
1 commit
expand
lexicons,appview,spindle: add workflow cancel
expand 6 comments

requesting a review @oppi.li

can we allow owners to also cancel pipelines?

sorry, i mean collaborators.

@oppi.li I'm not sure how should I implement that. We don't have repo:pipeline action defined for repo owners and contributors.

For example, setting access is controlled by repo:settings.

Should I just check for both repo:owner and repo:contributor as a dirty fix?

can we allow collaborators to also cancel pipelines?

@oppi.li I think we can merge this for now. Spindle's collaborator ingesting logic is currently broken so allowing them to cancel pipelines will reveal the bug. I'll make it possible on upcoming PR I'm working on sl/spindle-rewrite branch.

reviews:

  • here, we should use config.Core.Dev
  • here, don't set expiry, the default is already 60s into the future
  • there is no auth filter for the cancel button on the appview side, the button should only be visible to repo owners + collaborators, and the /workflow/cancel endpoint should return 403 for non-collaborators and non-owners.
  • here, the error message needs to be "Failed to cancel workflow", not "Failed to add secret"

the rest of the code is brilliant, will give this a test locally as well!

1 commit
expand
lexicons,appview,spindle: add workflow cancel
expand 0 comments