~sircmpwn/sr.ht-discuss

4 4

Trigger build on master branch only

Details
Message ID
<3cd90a91b7ce113bb3c5f07898c77543@hacktivista.com>
Sender timestamp
1562301395
DKIM signature
missing
Download raw message
I'd like to use different parts of the build manifest file depending on
the branch I'm pushing, for instance on `dev` I'd like to run tests,
but on `master` I'd like to `deploy`. Is it even feasible out of the
box? If not, what's the recommended course of action?

Felix.
Details
Message ID
<BVB1VMTEWSYX.16DDFWUTXGJTE@Terminator>
In-Reply-To
<3cd90a91b7ce113bb3c5f07898c77543@hacktivista.com> (view parent)
Sender timestamp
1562302113
DKIM signature
missing
Download raw message
> I'd like to use different parts of the build manifest file depending on
> the branch I'm pushing, for instance on `dev` I'd like to run tests,
> but on `master` I'd like to `deploy`. Is it even feasible out of the
> box? If not, what's the recommended course of action?

I guess one of the easier way is to check the branch into the build
script then exit if it is not master. The build will trigger on any push
but not have consequences.
dax
Details
Message ID
<4469ED70-5D48-4FF5-A54D-BB19D8E51F21@dax.moe>
In-Reply-To
<3cd90a91b7ce113bb3c5f07898c77543@hacktivista.com> (view parent)
Sender timestamp
1562302287
DKIM signature
missing
Download raw message
On July 5, 2019 4:36:35 AM UTC, sir@hacktivista.com wrote:
>I'd like to use different parts of the build manifest file depending on
>the branch I'm pushing, for instance on `dev` I'd like to run tests,
>but on `master` I'd like to `deploy`. 

You could have a different build manifests in each branch.
Details
Message ID
<BVB2PW3LX79X.NR11HZD3JWJO@illya>
In-Reply-To
<3cd90a91b7ce113bb3c5f07898c77543@hacktivista.com> (view parent)
Sender timestamp
1562304484
DKIM signature
missing
Download raw message
> I'd like to use different parts of the build manifest file depending on
> the branch I'm pushing, for instance on `dev` I'd like to run tests,
> but on `master` I'd like to `deploy`. Is it even feasible out of the
> box? If not, what's the recommended course of action?

I don't see a mechanism in the manifests for setting constraints
on when a task should be run. This is a feature on other build
servers that I've used and it's something I think would be useful
here as well. As others have said, you can probably add logic
into your script that accomplishes the same goal, but you lose
some visibility into what each task is really doing by putting
conditional branches into the task.
Tim Schumacher
Details
Message ID
<8636jlt34u.wl-tim@datenknoten.me>
In-Reply-To
<3cd90a91b7ce113bb3c5f07898c77543@hacktivista.com> (view parent)
Sender timestamp
1562307553
DKIM signature
missing
Download raw message
Hi Felix,

On Fri, 05 Jul 2019 06:36:35 +0200,
sir@hacktivista.com wrote:
> 
> I'd like to use different parts of the build manifest file depending on
> the branch I'm pushing, for instance on `dev` I'd like to run tests,
> but on `master` I'd like to `deploy`. Is it even feasible out of the
> box? If not, what's the recommended course of action?
> 
> Felix.

I have something like this in my build.yml:

```
      # if not on develop branch skip the next stages
      if [ "$(git rev-parse origin/develop)" != "$(git rev-parse HEAD)" ]; then \
        complete-build; \
      fi
```

https://git.sr.ht/~xaffe/takingstack/tree/develop/.build.yml#L41

love

Tim
Export thread (mbox)