#1778  Branch update trigger from branch without .onedev-buildspec.yml
Closed
Jennings Zhang opened 2 months ago

I have an instance of OneDev deployed in a private network for the purposes of doing CD inside of the private network. My repo has two branches: master and prod. prod is the default branch which contains a .onedev-buildspec.yml. One of the jobs defined is to sync master with a public GitHub repo:

- name: Pull from GitHub
  steps:
  - !PullRepository
    name: pull
    remoteUrl: https://github.com/jennydaman/ChRIS_ui.git
    syncToChildProject: false
    refs: refs/heads/master
    withLfs: false
    force: false
    condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
  triggers:
  - !ScheduleTrigger
    cronExpression: 0 0 1 * * ?
  retryCondition: never
  maxRetries: 3
  retryDelay: 30
  timeout: 3600

Since master is synced with the public GitHub repository, it does not and should not contain a .onedev-buildspec.yml file. The syncing of master branch works fine.

However, in the .onedev-buildspec.yml of the prod branch I have a second job which is supposed to trigger when the master branch updates:

  triggers:
  - !BranchUpdateTrigger
    branches: master

This trigger does not work and the job does not run when the master branch is updated, no matter whether it's updated by the Pull from GitHub job or manually from the command line with git push origin master.

Jennings Zhang commented 2 months ago

For what I am trying to do I found an elegant workaround, nonetheless this seems like a bug, or at least unclear behavior.

Robin Shen changed state to 'Closed' 2 months ago
Previous Value Current Value
Open
Closed
Robin Shen commented 2 months ago

This is expected behavior. When a branch is updated, only the build spec defined in updated commit is checked (in your case, no build spec in master branch) to trigger necessary jobs.

Robin Shen commented 2 months ago

Whenever a commit is involved in CI/CD, only its associated build spec is used. This makes CI/CD logic living together with code and is key for "CI/CD as code".

issue 1 of 1
Type
Bug
Priority
Normal
Assignee
Affected Versions
10.2.1
Labels
No labels
Issue Votes (0)
Watchers (3)
Reference
onedev/server#1778
Please wait...
Page is in error, reload to recover