Skip to contentSkip to conversation

automation: avoid duplicated builds of staging branch

PATCH In review Marek Marczykowski-Górecki 4 participants 12 messages Jul 17, 2023 – Jul 24, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 automation: avoid duplicated builds of staging branch

"staging" branch is mirrored (automatically or manually) to several repositories. Avoid building it several times to not waste runner resources.

---
 .gitlab-ci.yml | 6 ++++++
 1 file changed, 6 insertions(+)
.gitlab-ci.yml +6 -0
index c8bd7519d5fb..c3b05e32636b 100644
@@ -2,6 +2,12 @@ stages:
   - build
   - test
 
+workflow:
+  rules:
+    - if: '$CI_COMMIT_REF_NAME == "staging" && $CI_PROJECT_NAMESPACE != "xen-project"'
+      when: never
+    - when: always
+
 include:
   - 'automation/gitlab-ci/build.yaml'
   - 'automation/gitlab-ci/test.yaml'
Signature · 1 line
2.41.0
#1 lore raw
Quoted 14 lines · Marek Marczykowski-Górecki

"staging" branch is mirrored (automatically or manually) to several repositories. Avoid building it several times to not waste runner resources.

---
 .gitlab-ci.yml | 6 ++++++
 1 file changed, 6 insertions(+)
.gitlab-ci.yml +0 -0
index c8bd7519d5fb..c3b05e32636b 100644

.gitlab-ci.yml stages: · line 9

Quoted 8 lines
.gitlab-ci.yml +5 -0
@@ -2,6 +2,12 @@ stages:
   - build
   - test
 
+workflow:
+  rules:
+    - if: '$CI_COMMIT_REF_NAME == "staging" && $CI_PROJECT_NAMESPACE != "xen-project"'
+      when: never
+    - when: always

If we're doing this for staging, we should include staging-* and stable-*.  They're all the same from this point of view.

However, this does need double checking with the committers who use gitlab regularly (CC'd).  This doesn't happen to interfere with my commit workflow (I use a separate branch called for-staging), but I can't talk for others.

~Andrew

#2 lore raw
Quoted 27 lines · Andrew Cooper
Quoted 14 lines · Marek Marczykowski-Górecki

"staging" branch is mirrored (automatically or manually) to several repositories. Avoid building it several times to not waste runner resources.

---
 .gitlab-ci.yml | 6 ++++++
 1 file changed, 6 insertions(+)
.gitlab-ci.yml +0 -0
index c8bd7519d5fb..c3b05e32636b 100644

.gitlab-ci.yml stages: · line 9

Quoted 8 lines
.gitlab-ci.yml +5 -0
@@ -2,6 +2,12 @@ stages:
   - build
   - test
 
+workflow:
+  rules:
+    - if: '$CI_COMMIT_REF_NAME == "staging" && $CI_PROJECT_NAMESPACE != "xen-project"'
+      when: never
+    - when: always

If we're doing this for staging, we should include staging-* and stable-*.  They're all the same from this point of view.

Quoted 4 lines

However, this does need double checking with the committers who use gitlab regularly (CC'd).  This doesn't happen to interfere with my commit workflow (I use a separate branch called for-staging), but I can't talk for others.

I'd like to avoid broad patterns like staging-* or stable-* here, I'm pretty sure people do use branches like staging-X.Y-something. While it would be possible to exclude them by listing exact names, I'm not sure if it's worth it, given the push frequency to them (few times a month) and those being mirrored to less repositories (only FuSa fork?).

Signature · 3 lines
Best Regards,
Marek Marczykowski-Górecki
Invisible Things Lab
#3 lore raw
Quoted 5 lines · Marek Marczykowski-Górecki
Quoted 4 lines · Andrew Cooper
Quoted 3 lines · Marek Marczykowski-Górecki

"staging" branch is mirrored (automatically or manually) to several repositories. Avoid building it several times to not waste runner resources.

Hi Marek,

Let me try to understand the use-case a bit better. You would like the following "staging" branch to run a full pipeline:
https://gitlab.com/xen-project/xen

But if someone under xen-project/people is mirroring
https://gitlab.com/xen-project/xen, this patch is attempting to skip the additional pipeline. For instance, if I am mirroring staging in my personal repo:

https://gitlab.com/xen-project/people/sstabellini/xen

We are skipping the additional pipeline there.

Is that correct? If so, it would be easier to ask everyone to make sure they have "Trigger pipelines for mirror updates" unselected:

https://docs.gitlab.com/ee/user/project/repository/mirror/pull.html#trigger-pipelines-for-mirror-updates

Quoted 32 lines
Quoted 22 lines
Quoted 10 lines
---
 .gitlab-ci.yml | 6 ++++++
 1 file changed, 6 insertions(+)
.gitlab-ci.yml +0 -0
index c8bd7519d5fb..c3b05e32636b 100644

.gitlab-ci.yml stages: · line 9

Quoted 8 lines
.gitlab-ci.yml +5 -0
@@ -2,6 +2,12 @@ stages:
   - build
   - test
 
+workflow:
+  rules:
+    - if: '$CI_COMMIT_REF_NAME == "staging" && $CI_PROJECT_NAMESPACE != "xen-project"'
+      when: never
+    - when: always

If we're doing this for staging, we should include staging-* and stable-*.  They're all the same from this point of view.

Quoted 4 lines

However, this does need double checking with the committers who use gitlab regularly (CC'd).  This doesn't happen to interfere with my commit workflow (I use a separate branch called for-staging), but I can't talk for others.

I'd like to avoid broad patterns like staging-* or stable-* here, I'm pretty sure people do use branches like staging-X.Y-something. While it would be possible to exclude them by listing exact names, I'm not sure if it's worth it, given the push frequency to them (few times a month) and those being mirrored to less repositories (only FuSa fork?).

#4 lore raw
Quoted 13 lines · Stefano Stabellini
Quoted 5 lines · Marek Marczykowski-Górecki
Quoted 4 lines · Andrew Cooper
Quoted 3 lines · Marek Marczykowski-Górecki

"staging" branch is mirrored (automatically or manually) to several repositories. Avoid building it several times to not waste runner resources.

Hi Marek,

Let me try to understand the use-case a bit better. You would like the following "staging" branch to run a full pipeline:
https://gitlab.com/xen-project/xen

Quoted 8 lines

But if someone under xen-project/people is mirroring
https://gitlab.com/xen-project/xen, this patch is attempting to skip the additional pipeline. For instance, if I am mirroring staging in my personal repo:

https://gitlab.com/xen-project/people/sstabellini/xen

We are skipping the additional pipeline there.

Yes.

Quoted 4 lines

Is that correct? If so, it would be easier to ask everyone to make sure they have "Trigger pipelines for mirror updates" unselected:

https://docs.gitlab.com/ee/user/project/repository/mirror/pull.html#trigger-pipelines-for-mirror-updates

If that's set in gitlab as pull mirror (instead of push from somewhere else), then that indeed may be enough. But is it really in all those cases?

Quoted 32 lines
Quoted 32 lines
Quoted 22 lines
Quoted 10 lines
---
 .gitlab-ci.yml | 6 ++++++
 1 file changed, 6 insertions(+)
.gitlab-ci.yml +0 -0
index c8bd7519d5fb..c3b05e32636b 100644

.gitlab-ci.yml stages: · line 9

Quoted 8 lines
.gitlab-ci.yml +5 -0
@@ -2,6 +2,12 @@ stages:
   - build
   - test
 
+workflow:
+  rules:
+    - if: '$CI_COMMIT_REF_NAME == "staging" && $CI_PROJECT_NAMESPACE != "xen-project"'
+      when: never
+    - when: always

If we're doing this for staging, we should include staging-* and stable-*.  They're all the same from this point of view.

Quoted 4 lines

However, this does need double checking with the committers who use gitlab regularly (CC'd).  This doesn't happen to interfere with my commit workflow (I use a separate branch called for-staging), but I can't talk for others.

I'd like to avoid broad patterns like staging-* or stable-* here, I'm pretty sure people do use branches like staging-X.Y-something. While it would be possible to exclude them by listing exact names, I'm not sure if it's worth it, given the push frequency to them (few times a month) and those being mirrored to less repositories (only FuSa fork?).

Signature · 3 lines
Best Regards,
Marek Marczykowski-Górecki
Invisible Things Lab
#5 lore raw
Quoted 25 lines · Marek Marczykowski-Górecki
Quoted 13 lines · Stefano Stabellini
Quoted 5 lines · Marek Marczykowski-Górecki
Quoted 4 lines · Andrew Cooper
Quoted 3 lines · Marek Marczykowski-Górecki

"staging" branch is mirrored (automatically or manually) to several repositories. Avoid building it several times to not waste runner resources.

Hi Marek,

Let me try to understand the use-case a bit better. You would like the following "staging" branch to run a full pipeline:
https://gitlab.com/xen-project/xen

Quoted 8 lines

But if someone under xen-project/people is mirroring
https://gitlab.com/xen-project/xen, this patch is attempting to skip the additional pipeline. For instance, if I am mirroring staging in my personal repo:

https://gitlab.com/xen-project/people/sstabellini/xen

We are skipping the additional pipeline there.

Yes.

Quoted 8 lines
Quoted 4 lines

Is that correct? If so, it would be easier to ask everyone to make sure they have "Trigger pipelines for mirror updates" unselected:

https://docs.gitlab.com/ee/user/project/repository/mirror/pull.html#trigger-pipelines-for-mirror-updates

If that's set in gitlab as pull mirror (instead of push from somewhere else), then that indeed may be enough. But is it really in all those cases?

Yes, it is an option in the pull mirror, by default should be unselected I believe.

#6 lore raw
Quoted 29 lines · Stefano Stabellini
Quoted 28 lines · Marek Marczykowski-Górecki
Quoted 13 lines · Stefano Stabellini
Quoted 5 lines · Marek Marczykowski-Górecki
Quoted 4 lines · Andrew Cooper
Quoted 3 lines · Marek Marczykowski-Górecki

"staging" branch is mirrored (automatically or manually) to several repositories. Avoid building it several times to not waste runner resources.

Hi Marek,

Let me try to understand the use-case a bit better. You would like the following "staging" branch to run a full pipeline:
https://gitlab.com/xen-project/xen

Quoted 8 lines

But if someone under xen-project/people is mirroring
https://gitlab.com/xen-project/xen, this patch is attempting to skip the additional pipeline. For instance, if I am mirroring staging in my personal repo:

https://gitlab.com/xen-project/people/sstabellini/xen

We are skipping the additional pipeline there.

Yes.

Quoted 3 lines

Is that correct? If so, it would be easier to ask everyone to make sure they have "Trigger pipelines for mirror updates" unselected:

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

https://docs.gitlab.com/ee/user/project/repository/mirror/pull.html#trigger-pipelines-for-mirror-updates

If that's set in gitlab as pull mirror (instead of push from somewhere else), then that indeed may be enough. But is it really in all those cases?

Yes, it is an option in the pull mirror, by default should be unselected I believe.

Well, if that's the case, either it got manually enabled on those 4 (?) forks, or those are using something else for mirroring the staging branch (in which case, the setting would not help). I can't see this part of the settings in other's repositories, so I don't know.

Signature · 3 lines
Best Regards,
Marek Marczykowski-Górecki
Invisible Things Lab
#7 lore raw
Quoted 36 lines · Marek Marczykowski-Górecki
Quoted 35 lines · Stefano Stabellini
Quoted 33 lines · Marek Marczykowski-Górecki
Quoted 13 lines · Stefano Stabellini
Quoted 5 lines · Marek Marczykowski-Górecki
Quoted 4 lines · Andrew Cooper
Quoted 3 lines · Marek Marczykowski-Górecki

"staging" branch is mirrored (automatically or manually) to several repositories. Avoid building it several times to not waste runner resources.

Hi Marek,

Let me try to understand the use-case a bit better. You would like the following "staging" branch to run a full pipeline:
https://gitlab.com/xen-project/xen

Quoted 8 lines

But if someone under xen-project/people is mirroring
https://gitlab.com/xen-project/xen, this patch is attempting to skip the additional pipeline. For instance, if I am mirroring staging in my personal repo:

https://gitlab.com/xen-project/people/sstabellini/xen

We are skipping the additional pipeline there.

Yes.

Quoted 4 lines

Is that correct? If so, it would be easier to ask everyone to make sure they have "Trigger pipelines for mirror updates" unselected:

https://docs.gitlab.com/ee/user/project/repository/mirror/pull.html#trigger-pipelines-for-mirror-updates

If that's set in gitlab as pull mirror (instead of push from somewhere else), then that indeed may be enough. But is it really in all those cases?

Quoted 7 lines
Quoted 2 lines

Yes, it is an option in the pull mirror, by default should be unselected I believe.

Well, if that's the case, either it got manually enabled on those 4 (?) forks, or those are using something else for mirroring the staging branch (in which case, the setting would not help). I can't see this part of the settings in other's repositories, so I don't know.

Do you know the name of those 4 forks? I can help figure it out.

#8 lore raw
Quoted 40 lines · Stefano Stabellini
Quoted 39 lines · Marek Marczykowski-Górecki
Quoted 37 lines · Stefano Stabellini
Quoted 25 lines · Marek Marczykowski-Górecki
Quoted 13 lines · Stefano Stabellini
Quoted 5 lines · Marek Marczykowski-Górecki
Quoted 4 lines · Andrew Cooper
Quoted 3 lines · Marek Marczykowski-Górecki

"staging" branch is mirrored (automatically or manually) to several repositories. Avoid building it several times to not waste runner resources.

Hi Marek,

Let me try to understand the use-case a bit better. You would like the following "staging" branch to run a full pipeline:
https://gitlab.com/xen-project/xen

Quoted 8 lines

But if someone under xen-project/people is mirroring
https://gitlab.com/xen-project/xen, this patch is attempting to skip the additional pipeline. For instance, if I am mirroring staging in my personal repo:

https://gitlab.com/xen-project/people/sstabellini/xen

We are skipping the additional pipeline there.

Yes.

Quoted 8 lines
Quoted 4 lines

Is that correct? If so, it would be easier to ask everyone to make sure they have "Trigger pipelines for mirror updates" unselected:

https://docs.gitlab.com/ee/user/project/repository/mirror/pull.html#trigger-pipelines-for-mirror-updates

If that's set in gitlab as pull mirror (instead of push from somewhere else), then that indeed may be enough. But is it really in all those cases?

Yes, it is an option in the pull mirror, by default should be unselected I believe.

Quoted 6 lines
Quoted 4 lines

Well, if that's the case, either it got manually enabled on those 4 (?) forks, or those are using something else for mirroring the staging branch (in which case, the setting would not help). I can't see this part of the settings in other's repositories, so I don't know.

Do you know the name of those 4 forks? I can help figure it out.

Looking at "activity" view on gitlab, I see those:
https://gitlab.com/xen-project/fusa/xen-integration
https://gitlab.com/xen-project/people/olkur/xen
https://gitlab.com/xen-project/people/andyhhp/xen

There are few more that have staging branch almost up to date, but seems to be pushed manually (based on it being not fully up to date) and less often.

Signature · 3 lines
Best Regards,
Marek Marczykowski-Górecki
Invisible Things Lab
#9 lore raw

Hi Andrew, Oleksii,

Please see below.

It looks like you have configured your personal repositories to mirror upstream Xen:

https://gitlab.com/xen-project/people/olkur/xen
https://gitlab.com/xen-project/people/andyhhp/xen

Make sure that the option "Trigger pipelines for mirror updates" is unselected.

If you setup the mirror a long time ago, you might want to stop the mirror and start it again.

I have just done the same for fusa/xen-integration: I had to go to settings->repository, stop the existing mirror, and create a new one making sure "Trigger pipelines for mirror updates" is off.

Cheers,

Stefano

Quoted 62 lines · Marek Marczykowski-Górecki
Quoted 40 lines · Stefano Stabellini
Quoted 39 lines · Marek Marczykowski-Górecki
Quoted 37 lines · Stefano Stabellini
Quoted 25 lines · Marek Marczykowski-Górecki
Quoted 13 lines · Stefano Stabellini
Quoted 5 lines · Marek Marczykowski-Górecki
Quoted 4 lines · Andrew Cooper
Quoted 3 lines · Marek Marczykowski-Górecki

"staging" branch is mirrored (automatically or manually) to several repositories. Avoid building it several times to not waste runner resources.

Hi Marek,

Let me try to understand the use-case a bit better. You would like the following "staging" branch to run a full pipeline:
https://gitlab.com/xen-project/xen

Quoted 8 lines

But if someone under xen-project/people is mirroring
https://gitlab.com/xen-project/xen, this patch is attempting to skip the additional pipeline. For instance, if I am mirroring staging in my personal repo:

https://gitlab.com/xen-project/people/sstabellini/xen

We are skipping the additional pipeline there.

Yes.

Quoted 8 lines
Quoted 4 lines

Is that correct? If so, it would be easier to ask everyone to make sure they have "Trigger pipelines for mirror updates" unselected:

https://docs.gitlab.com/ee/user/project/repository/mirror/pull.html#trigger-pipelines-for-mirror-updates

If that's set in gitlab as pull mirror (instead of push from somewhere else), then that indeed may be enough. But is it really in all those cases?

Yes, it is an option in the pull mirror, by default should be unselected I believe.

Quoted 6 lines
Quoted 4 lines

Well, if that's the case, either it got manually enabled on those 4 (?) forks, or those are using something else for mirroring the staging branch (in which case, the setting would not help). I can't see this part of the settings in other's repositories, so I don't know.

Do you know the name of those 4 forks? I can help figure it out.

Looking at "activity" view on gitlab, I see those:
https://gitlab.com/xen-project/fusa/xen-integration
https://gitlab.com/xen-project/people/olkur/xen
https://gitlab.com/xen-project/people/andyhhp/xen

There are few more that have staging branch almost up to date, but seems to be pushed manually (based on it being not fully up to date) and less often.

Signature · 3 lines
Best Regards,
Marek Marczykowski-Górecki
Invisible Things Lab
#10 lore raw

Hi Stefano,

Quoted 14 lines · Stefano Stabellini

Hi Andrew, Oleksii,

Please see below.

It looks like you have configured your personal repositories to mirror
upstream Xen:

https://gitlab.com/xen-project/people/olkur/xen
https://gitlab.com/xen-project/people/andyhhp/xen

Make sure that the option "Trigger pipelines for mirror updates" is unselected.

Quoted 6 lines

If you setup the mirror a long time ago, you might want to stop the mirror and start it again.

I have just done the same for fusa/xen-integration: I had to go to settings->repository, stop the existing mirror, and create a new one making sure "Trigger pipelines for mirror updates" is off.

I checked the option is unselected.

But I have selected "Mirror all branches" in "Mirror branches". I can use "Mirror specific branches" to avoid 'staging' mirroring.

Will it be enough?

~ Oleksii

Quoted 84 lines · Marek Marczykowski-Górecki
Quoted 80 lines · Stefano Stabellini
Quoted 62 lines · Marek Marczykowski-Górecki
Quoted 53 lines
Quoted 47 lines · Stefano Stabellini
Quoted 38 lines · Marek Marczykowski-Górecki
Quoted 25 lines · Stefano Stabellini
Quoted 9 lines · Marek Marczykowski-Górecki
Quoted 7 lines · Andrew Cooper
Quoted 5 lines · Marek Marczykowski-Górecki

"staging" branch is mirrored (automatically or
manually) to several
repositories. Avoid building it several times to
not waste runner
resources.

Hi Marek,

Let me try to understand the use-case a bit better. You would like the
following "staging" branch to run a full pipeline:
https://gitlab.com/xen-project/xen

But if someone under xen-project/people is mirroring
https://gitlab.com/xen-project/xen, this patch is attempting to skip the
additional pipeline. For instance, if I am mirroring staging in my
personal repo:

Quoted 3 lines

https://gitlab.com/xen-project/people/sstabellini/xen

We are skipping the additional pipeline there.

Yes.

Quoted 5 lines

Is that correct? If so, it would be easier to ask everyone to make sure
they have "Trigger pipelines for mirror updates" unselected:

Quoted 7 lines
Quoted 1 line

https://docs.gitlab.com/ee/user/project/repository/mirror/pull.html#trigger-pipelines-for-mirror-updates

If that's set in gitlab as pull mirror (instead of push from somewhere
else), then that indeed may be enough. But is it really in all those
cases?

Quoted 3 lines

Yes, it is an option in the pull mirror, by default should be unselected
I believe.

Quoted 7 lines

Well, if that's the case, either it got manually enabled on those 4 (?)
forks, or those are using something else for mirroring the staging
branch (in which case, the setting would not help). I can't see this
part of the settings in other's repositories, so I don't know.

Quoted 1 line

Do you know the name of those 4 forks? I can help figure it out.

Looking at "activity" view on gitlab, I see those:
https://gitlab.com/xen-project/fusa/xen-integration
https://gitlab.com/xen-project/people/olkur/xen
https://gitlab.com/xen-project/people/andyhhp/xen

There are few more that have staging branch almost up to date, but seems
to be pushed manually (based on it being not fully up to date) and less
often.

Signature · 3 lines
Best Regards,
Marek Marczykowski-Górecki
Invisible Things Lab
#11 lore raw
Quoted 23 lines · Oleksii

Hi Stefano,

Quoted 14 lines · Stefano Stabellini

Hi Andrew, Oleksii,

Please see below.

It looks like you have configured your personal repositories to mirror
upstream Xen:

https://gitlab.com/xen-project/people/olkur/xen
https://gitlab.com/xen-project/people/andyhhp/xen

Make sure that the option "Trigger pipelines for mirror updates" is unselected.

Quoted 6 lines

If you setup the mirror a long time ago, you might want to stop the mirror and start it again.

I have just done the same for fusa/xen-integration: I had to go to settings->repository, stop the existing mirror, and create a new one making sure "Trigger pipelines for mirror updates" is off.

Quoted 6 lines

I checked the option is unselected.

But I have selected "Mirror all branches" in "Mirror branches". I can use "Mirror specific branches" to avoid 'staging' mirroring.

Will it be enough?

My understanding is that if you already have "Trigger pipelines for mirror updates" unselected, then you shouldn't need anything else.