#630  Can't connect 'fixed issues' to builds?
Closed
Ruben Flinterman opened 2 years ago

I recently added jobs to my OneDev instance and if I'm understanding it correctly, you link (fixed) issues by adding a milestone which has the same name as the build version? If this is the case, it doesn't seem to work for me (same goes for markdown reports). Did I do anything wrong in my config/buildspec file?

version: 15
jobs:
- name: CI
  steps:
  - !CheckoutStep
    name: checkout
    cloneCredential: !DefaultCredential {}
    withLfs: false
    withSubmodules: true
    cloneDepth: 1
    condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
  - !CommandStep
    name: detect build version
    runInContainer: false
    interpreter: !DefaultInterpreter
      commands:
      - set -e
      - echo "Detecting project version (may require some time)..."
      - json=@secrets:build-version@
      - echo $json > buildVersion
    useTTY: false
    condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
  - !SetBuildVersionStep
    name: set build version
    buildVersion: '@file:buildVersion@'
    condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
  retryCondition: never
  maxRetries: 3
  retryDelay: 30
  cpuRequirement: 500
  memoryRequirement: 256
  timeout: 3600
- name: Release
  steps:
  - !CheckoutStep
    name: checkout
    cloneCredential: !DefaultCredential {}
    withLfs: false
    withSubmodules: true
    condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
  - !CommandStep
    name: detect build version
    runInContainer: false
    interpreter: !DefaultInterpreter
      commands:
      - set -e
      - echo "Detecting project version (may require some time)..."
      - json=@secrets:build-version@
      - echo $json > buildVersion
    useTTY: false
    condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
  - !SetBuildVersionStep
    name: set build version
    buildVersion: '@file:buildVersion@'
    condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
  - !PublishArtifactStep
    name: publish artifact
    artifacts: '*.zip'
    condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
  - !PublishMarkdownReportStep
    name: publish markdown report
    reportName: Incompatibilities
    filePatterns: server-product/system/incompatibilities/**
    startPage: server-product/system/incompatibilities/incompatibilities.md
    condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
  - !CloseMilestoneStep
    name: close milestone
    milestoneName: '@build_version@'
    condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
  jobDependencies:
  - jobName: CI
    requireSuccessful: true
  retryCondition: never
  maxRetries: 3
  retryDelay: 30
  cpuRequirement: 250
  memoryRequirement: 128
  timeout: 3600
- name: Sync Main (Github)
  jobExecutor: Server-Docker-Executor
  steps:
  - !CheckoutStep
    name: checkout
    cloneCredential: !DefaultCredential {}
    withLfs: false
    withSubmodules: true
    condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
  - !CommandStep
    name: sync
    runInContainer: true
    image: alpine/git:1.0.7
    interpreter: !DefaultInterpreter
      commands:
      - git config --global --unset http.extraHeader
      - git push -f https://rflintstone:@secrets:github-token@@@github.com/project-3-4/landserver
        HEAD:main
    useTTY: false
    condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
  triggers:
  - !BranchUpdateTrigger
    branches: main
    projects: Test
  retryCondition: never
  maxRetries: 3
  retryDelay: 30
  cpuRequirement: 250
  memoryRequirement: 128
  timeout: 3600
- name: Create package.json
  steps:
  - !CommandStep
    name: Create package.json
    runInContainer: false
    interpreter: !DefaultInterpreter
      commands:
      - '#json=''{"buildVersion": "someversion"}'''
      - json=@secrets:build-version@
      - echo "$json" > package.json
    useTTY: false
    condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
  retryCondition: never
  maxRetries: 3
  retryDelay: 30
  cpuRequirement: 500
  memoryRequirement: 256
  timeout: 3600
- name: Get Milestone
  steps:
  - !CommandStep
    name: Get build version
    runInContainer: false
    interpreter: !DefaultInterpreter
      commands:
      - echo @build_version@
    useTTY: false
    condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
  retryCondition: never
  maxRetries: 3
  retryDelay: 30
  cpuRequirement: 500
  memoryRequirement: 256
  timeout: 3600
Robin Shen commented 2 years ago

No issues are not linked to build via milestone. It is linked via commit message: https://code.onedev.io/projects/162/blob/main/pages/fix-issues-via-commit-message.md

When determine fixed issues of a build, OneDev compares this build with previous build on same stream, to get list of commits, and then get fixed issues from commit messages.

Ruben Flinterman commented 2 years ago

Thank you, that worked! 😄 Can you also do this with multiple issues in one commit message? (i.e resolve issue #200 and #201)

Robin Shen commented 2 years ago

This can be achieved this way:

Fix issue #200: some optional description Fix issue #201: some optional descriptioni

Robin Shen changed state to 'Closed' 2 years ago
Previous Value Current Value
Open
Closed
issue 1 of 1
Type
Question
Priority
Normal
Assignee
Issue Votes (0)
Watchers (4)
Reference
onedev/server#630
Please wait...
Page is in error, reload to recover