Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

after upgrade bitbucket server to version 8.9.0, keyNotFound 'tasks' #594

Open
jfernand21 opened this issue Sep 20, 2023 · 1 comment
Open

Comments

@jfernand21
Copy link

Report

danger executions fail, after upgrate bitbucket server to version 8.9.0

What did you do?

We are running whitout any issue in our jenkins server with bitbucket server version 7. After the upgrade of the bitbucket server to version 8.9, the danger stage in ours pipelines stop working

ℹ we run this command
DEBUG=* danger-swift ci --cwd ../

What did you expect to happen?

We are expecting that the command execution happen successfully and comment the PR associated

ℹ Please replace this with what you expected to happen.
Running your Dangerfile without it crashing.

What happened instead?

The execution fail with a error parse the bitbucket server informations of the PR

ℹ The error returning is this:

Decoding the DSL into Swift types
 ERROR: Failed to parse JSON: keyNotFound(CodingKeys(stringValue: "tasks", intValue: nil), Swift.DecodingError.Context(codingPath: [CodingKeys(stringValue: "danger", intValue: nil), CodingKeys(stringValue: "bitbucket_server", intValue: nil), CodingKeys(stringValue: "comments", intValue: nil), _JSONKey(stringValue: "Index 6", intValue: 6), CodingKeys(stringValue: "comment", intValue: nil), CodingKeys(stringValue: "comments", intValue: nil), _JSONKey(stringValue: "Index 0", intValue: 0)], debugDescription: "No value associated with key CodingKeys(stringValue: \"tasks\", intValue: nil) (\"tasks\").", underlyingError: nil))

Your Environment

  • Which CI are you running on?
    Jenkins 2.289.3
  • Are you running the latest version of Danger?
    Danger Swift runner (v3.17.1)
  • What is your Dangerfile?
import Danger
import DangerSwiftCoverage // package: https://github.com/f-meloni/danger-swift-coverage.git
import DangerXCodeSummary // package: https://github.com/f-meloni/danger-swift-xcodesummary.git

let danger = Danger()
let editedFiles = danger.git.modifiedFiles + danger.git.createdFiles
let swiftFiles = editedFiles.filter { $0.fileType == .swift }
let swiftFilesForLint = editedFiles.filter { $0.contains("iOSUIComponents/Classes/") }

if editedFiles.count - danger.git.deletedFiles.count > 300 {
  warn("Big PR, try to keep changes smaller if you can")
}

let swiftFilesWithCopyright = danger.git.createdFiles.filter {
  $0.fileType == .swift
    && danger.utils.readFile($0).contains("//  Created by")
}

if !swiftFilesWithCopyright.isEmpty {
  let files = swiftFilesWithCopyright.joined(separator: ", ")
  warn("In Danger we don't include copyright headers, found them in: \(files)")
}

func filesWithUnauthorizedAbbreviations(files: [File]) {
  let unAuthorizedAbbreviations = ["VM.swift", "VS.swift", "VD.swift", "VC.swift"]
  let detectedFiles = files.filter { unAuthorizedAbbreviations.contains(where: $0.name.contains) }
  for file in detectedFiles {
    fail("Unauthorized Abbreviation in \(file)")
  }
}
filesWithUnauthorizedAbbreviations(files: swiftFiles)

let hasNotDescription = danger.bitbucketServer.pullRequest.description ?? ""
if hasNotDescription.isEmpty {
  message("Please, provide a PR description.")
}

SwiftLint.lint(.files(swiftFilesForLint),
               configFile: ".swiftlint.yml",
               swiftlintPath: "./Demo/Pods/SwiftLint/swiftlint")
Coverage.xcodeBuildCoverage(.derivedDataFolder("./DerivedData"), minimumCoverage: 80)
@jfernand21 jfernand21 changed the title after upgrate bitbucket server to version 8.9.0, keyNotFound 'tasks' after upgrade bitbucket server to version 8.9.0, keyNotFound 'tasks' Sep 20, 2023
@dromerobarria
Copy link
Contributor

dromerobarria commented Sep 21, 2023

Hi, I already generate a PR to solve this, changing the "Tasks" array value to optional.

#595

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants