~sircmpwn/builds.sr.ht#170: 
Option to only deploy from a specific branch

One way I could see this being implemented is by adding a branch option to a task. The syntax might look something like this:

tasks:
 - deploy:
     branch: master
     run: |
       rsync ...

A current workaround would be:

tasks:
  - deploy: |
      cd repo_name
      # We only want to deploy when on master. We cain't just check if
      # --abbrev-ref is master since the HEAD is detached.
      if [ "$(git rev-parse master)" = "$(git rev-parse HEAD)" ]; then
        rsync ...
      else
        echo "Not on master, skipping..."
      fi
Status
RESOLVED IMPLEMENTED
Submitter
~nloomans
Assigned to
No-one
Submitted
5 years ago
Updated
7 months ago
Labels
No labels applied.

~vija02 5 years ago

+1 Would love to have this as an option. Related: https://todo.sr.ht/%7Esircmpwn/dispatch.sr.ht/15

~sircmpwn 5 years ago

Workaround: the special complete-build command can be used to end a build early (without failing it).

~djhenk 5 years ago

+1 for me as well. But combining your suggestions works, so no hurry.

tasks:

  • check-branch: | cd repo_name if [ "$(git rev-parse master)" != "$(git rev-parse HEAD)" ]; then
    complete-build;
    fi

~djhenk 5 years ago

Eh.. it says 'Markdown supported loud and clear. Still forgot it.

tasks: 
- check-branch: | 
   cd repo_name 
   if [ "$(git rev-parse master)" != "$(git rev-parse HEAD)" ]; then \        
      complete-build; \ 
   fi

~dxld 7 months ago

git.sr.ht can now pass along GIT_REF to the build environment. This can be closed, see https://man.sr.ht/builds.sr.ht/#gitsrht

Side note: "complete-build" seems undocumented, perhaps it should be?

~sircmpwn REPORTED IMPLEMENTED 7 months ago

~sircmpwn 7 months ago

complete-build is a hack which will someday be replaced with something better, so it's been left undocumented to ease the transition to the new system.

Register here or Log in to comment, or comment via email.