danger / swift

⚠️ Stop saying "you forgot to …" in code review
https://danger.systems/swift/
MIT License
1.04k stars 135 forks source link

Error after migrating from Github repository to Gitlab #603

Open leoniralves opened 5 months ago

leoniralves commented 5 months ago

I'm trying to migrate danger-swift from Github to Gitlab on a self-hosted server, but it's failing. I followed this tutorial for configure env vars.

I'm using the SPM for install Danger Swift and dependencies.

My Package.swift:

let package = Package(
    name: "Project",
    products: [
        .library(
            name: "DangerDeps",
            type: .dynamic,
            targets: ["DangerDependencies"]),
    ],
    dependencies: [
        .package(
            url: "https://github.com/danger/swift.git",
            from: "3.18.0"),
        .package(
            url: "https://github.com/f-meloni/danger-swift-coverage.git",
            from: "1.2.1"),
        .package(
            url: "https://github.com/f-meloni/danger-swift-xcodesummary",
            from: "1.2.1"),
    ],
    targets: [
        .target(
            name: "DangerDependencies",
            dependencies: [
                .product(name: "Danger", package: "swift"),
                .product(name: "DangerSwiftCoverage", package: "danger-swift-coverage"),
                .product(name: "DangerXCodeSummary", package: "danger-swift-xcodesummary")
            ],
            path: "DangerDeps"),
    ]
)

My run script:

#!/bin/sh

# Install Brew dependencies
brew bundle

# Swift Package Manager
swift build --target DangerDependencies

# Run Danger-Swift
swift build danger-swift ci --verbose

The error from Bitrise

------------------------------
--- Step: ./.run_danger.sh ---
------------------------------
$ ./.run_danger.sh
▸ Using danger/tap/danger-swift
▸ Using lizard-analyzer
▸ Using swiftlint
▸ Using sonar-scanner
▸ Homebrew Bundle complete! 4 Brewfile dependencies now installed.
▸ Error:  HTTPError: Response code 404 (Not Found)
▸ at Request.<anonymous> (/snapshot/danger-js/node_modules/got/dist/source/as-promise/index.js:118:42)
▸ at processTicksAndRejections (node:internal/process/task_queues:96:5) {
▸ code: 'ERR_NON_2XX_3XX_RESPONSE',
▸ timings: {
▸ start: 1705342648287,
▸ socket: 1705342648289,
▸ lookup: 1705342648302,
▸ connect: 1705342648371,
▸ secureConnect: 1705342648549,
▸ upload: 1705342648550,
▸ response: 1705342648655,
▸ end: 1705342648655,
▸ error: undefined,
▸ abort: undefined,
▸ phases: {
▸ wait: 2,
▸ dns: 13,
▸ tcp: 69,
▸ tls: 178,
▸ request: 1,
▸ firstByte: 105,
▸ download: 0,
▸ total: 368
▸ }
▸ },
▸ description: undefined
▸ }
▸ Launching Danger Swift ci (v3.18.0)
▸ Finding out where the danger executable is
▸ Running: /opt/homebrew/bin/danger ci --process danger-swift --passURLForDSL --verbose

Can someone help me? 😉

f-meloni commented 5 months ago

It seems it is not finding danger-js

▸ Error:  HTTPError: Response code 404 (Not Found)
▸ at Request.<anonymous> (/snapshot/danger-js/node_modules/got/dist/source/as-promise/index.js:118:42)
▸ at processTicksAndRejections (node:internal/process/task_queues:96:5) {

Have you tried to install it manually with brew?

leoniralves commented 5 months ago

It seems it is not finding danger-js

▸ Error:  HTTPError: Response code 404 (Not Found)
▸ at Request.<anonymous> (/snapshot/danger-js/node_modules/got/dist/source/as-promise/index.js:118:42)
▸ at processTicksAndRejections (node:internal/process/task_queues:96:5) {

Have you tried to install it manually with brew?

@f-meloni Yes, I tried installing from brew without SPM. The error is the same.

leoniralves commented 5 months ago

@f-meloni When I tried the danger-gitlab (without DangerSwift) with Ruby's Dangerfile, everything worked.

f-meloni commented 5 months ago

Danger Ruby doesn't use danger-js. Have you tried to install danger-js with brew, before using/installing Danger-Swift?

leoniralves commented 5 months ago

@f-meloni I hadn't tried it yet. I tried now.

# 'brew install'
brew "danger/tap/danger-js"
brew "danger/tap/danger-swift"
f-meloni commented 5 months ago

It seems that the issue is actually on danger-js, the request to install it is failing. Not much I can suggest in this case, but if you are using Danger Swift with SPM you can use npm to install danger-js, that might fix the issue.

leoniralves commented 5 months ago

@f-meloni I don't understand why this Bitrise pipeline was working from Github and now not from Gitlab. 🤔

leoniralves commented 5 months ago

It seems that the issue is actually on danger-js, the request to install it is failing. Not much I can suggest in this case, but if you are using Danger Swift with SPM you can use npm to install danger-js, that might fix the issue.

@f-meloni It really seems like danger-js is not installing correctly.

Skipping install of danger-js formula. It is already installed.

Run brew command
Brew prefix: /opt/homebrew
Active arch: arm64
$ brew "bundle" "-v"
/opt/homebrew/bin/brew tap homebrew/bundle
==> Tapping homebrew/bundle
Cloning into '/opt/homebrew/Library/Taps/homebrew/homebrew-bundle'...
Tapped 1 command (107 files, 2.2MB).
Skipping install of danger-js formula. It is already installed.
Using danger/tap/danger-js
Upgrading danger/tap/danger-swift
Upgrading danger-swift formula. It is installed but not up-to-date.
==> Upgrading 1 outdated package:
danger/tap/danger-swift 3.16.0 -> 3.18.0
==> Fetching danger/tap/danger-swift
==> Downloading https://github.com/danger/danger-swift/archive/3.18.0.tar.gz
==> Downloading from https://codeload.github.com/danger/swift/tar.gz/refs/tags/3.18.0
==> Upgrading danger/tap/danger-swift
  3.16.0 -> 3.18.0 
leoniralves commented 5 months ago

It seems that the issue is actually on danger-js, the request to install it is failing. Not much I can suggest in this case, but if you are using Danger Swift with SPM you can use npm to install danger-js, that might fix the issue.

About installing danger-js from npm. I already tried, but it didn't work. 😞