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

Post setup-jfrog cleanup fails with v4.4.0 (works with v4.3.2) #206

Open
anscfrisson opened this issue Sep 4, 2024 · 9 comments
Open

Post setup-jfrog cleanup fails with v4.4.0 (works with v4.3.2) #206

anscfrisson opened this issue Sep 4, 2024 · 9 comments
Assignees
Labels
bug Something isn't working

Comments

@anscfrisson
Copy link

Describe the bug

This bug appears in a private repository. This is the anonymized workflow:

...
- name: Setup Jfrog
        uses: jfrog/setup-jfrog-cli@v4
        env:
            JF_URL: ${{ env.ARTIFACTORY_URL }}
            JF_USER: ${{ secrets.ARTIFACTORY_USER }}
            JF_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }}
      - name: JFrog Ping
        # Returns OK if the connection is successful
        run: jf rt ping
      - name: Post artifact
        run: jf rt upload ${{ env.ARTIFACTORY_ARTIFACT }} ${{ env.ARTIFACTORY_PATH }}

Current behavior

Fails at "Post Setup Jfrog" if uses: jfrog/[email protected]:

Post job cleanup.
Run '/home/runner/k8s/index.js'
Checking connection to JFrog Artifactory
Check for unpublished modules
Collect the Git information
Publish the build info to JFrog Artifactory
/__w/_actions/jfrog/setup-jfrog-cli/v4/node_modules/@actions/exec/lib/toolrunner.js:592
                error = new Error(`The process '${this.toolPath}' failed with exit code ${this.processExitCode}`);
                        ^

Error: The process '/__w/_tool/jf/2.66.0/x64/jf' failed with exit code 1
    at ExecState._setResult (/__w/_actions/jfrog/setup-jfrog-cli/v4/node_modules/@actions/exec/lib/toolrunner.js:592:25)
    at ExecState.CheckComplete (/__w/_actions/jfrog/setup-jfrog-cli/v4/node_modules/@actions/exec/lib/toolrunner.js:575:18)
    at ChildProcess.<anonymous> (/__w/_actions/jfrog/setup-jfrog-cli/v4/node_modules/@actions/exec/lib/toolrunner.js:469:27)
    at ChildProcess.emit (node:events:519:28)
    at maybeClose (node:internal/child_process:1105:16)
    at ChildProcess._handle.onexit (node:internal/child_process:305:5)

Node.js v20.13.1
Error: Error: failed to run script step: command terminated with non-zero exit code: error executing command [sh -e /__w/_temp/386bb6d0-6b00-11ef-87d2-dd9b0dd8e501.sh], exit code 1
Error: Process completed with exit code 1.
Error: Executing the custom container implementation failed. Please contact your self hosted runner administrator.

Reproduction steps

No response

Expected behavior

No response

Setup JFrog CLI version

4.4.0

JFrog CLI version

2.66.0

Workflow operating system type and version

Ubuntu Jammy

JFrog Artifactory version (if relevant)

No response

JFrog Xray version (if relevant)

No response

@anscfrisson anscfrisson added the bug Something isn't working label Sep 4, 2024
@anscfrisson anscfrisson changed the title Post setup-jfrog fails with v4.4.0 (works with v4.3.2) Post setup-jfrog cleanup fails with v4.4.0 (works with v4.3.2) Sep 4, 2024
@EyalDelarea
Copy link
Contributor

Hey @anscfrisson,

Thank you for reporting this issue.

I attempted to reproduce the error on a private repository, but I was unable to replicate it.

We recently released version v4.4.1, which includes an updated CLI and additional logging. Could you please try updating and share the output again?

Also, does your workflow contain additional JFrog commands that you’re unable to share with us?

The more details you can provide, the better we’ll be able to identify and resolve the issue.

@AlexanderDavydov1
Copy link

I have the same issue. It started from today

@EyalDelarea
Copy link
Contributor

I have the same issue. It started from today

Hi @AlexanderDavydov1,
Are you also using a private repo with a self-hosted runner? If possible, could you share some details from your workflow and logs?
Thanks!

@EyalDelarea EyalDelarea self-assigned this Sep 5, 2024
@AlexanderDavydov1
Copy link

Are you also using a private repo with a self-hosted runner?
Yes, but change to v4.4.1 fixed issue

@EyalDelarea
Copy link
Contributor

Are you also using a private repo with a self-hosted runner?
Yes, but change to v4.4.1 fixed issue

Happy to hear that!
@anscfrisson can you confirm that updating to 4.4.1 fixed the issue for you too?

@EyalDelarea
Copy link
Contributor

@AlexanderDavydov1 and @anscfrisson,
Could you please review the post-action logs to confirm that there are no errors after the update? It would be helpful if you could share them here so we can ensure the issue doesn't reoccur.

Thank you!

@anscfrisson
Copy link
Author

@EyalDelarea

Using jfrog/[email protected] or jfrog/setup-jfrog-cli@master (at b9a85a8) both fail at

- name: Setup Jfrog
        uses: jfrog/setup-jfrog-cli@...
        env:
            JF_URL: ${{ env.ARTIFACTORY_URL }}
            JF_USER: ${{ secrets.ARTIFACTORY_USER }}
            JF_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }}

with:

  Downloading JFrog CLI from https://releases.jfrog.io/artifactory/jfrog-cli/v2/2.67.0/jfrog-cli-linux-amd64/jfrog
  /__w/_tool/jf/2.67.0/x64/jf config add setup-jfrog-cli-server --url *** --interactive=false --overwrite=true --user *** --password ***
  15:21:47 [Info] Trace ID for JFrog Platform logs: 592b4c36b2aa783b
  Error: 7 [Error] The following error was received while trying to encrypt your password: Artifactory response: 401 
  {
    "errors": [
      {
        "status": 401,
        "message": "Bad credentials"
      }
    ]
  } 
  Error: The process '/__w/_tool/jf/2.67.0/x64/jf' failed with exit code 1

Reverting back to jfrog/[email protected] works again with:

Setup JFrog CLI
  Downloading JFrog CLI from https://releases.jfrog.io/artifactory/jfrog-cli/v2/2.66.0/jfrog-cli-linux-amd64/jfrog
  /__w/_tool/jf/2.66.0/x64/jf config add setup-jfrog-cli-server --url *** --interactive=false --overwrite=true --user *** --password ***
  16:12:01 [Warn] You are using JFrog CLI version 2.66.0, however version 2.67.0 is available.
  To install the latest version, visit: https://jfrog.com/getcli
  To see the release notes, visit: https://github.com/jfrog/jfrog-cli/releases
  To avoid this message, set the JFROG_CLI_AVOID_NEW_VERSION_WARNING variable to TRUE

The problem seems to be with JFrog CLI version updates between 2.66.0 and 2.67.0.

From jfrog/jfrog-cli@v2.66.0...v2.67.0:

-	github.com/jfrog/jfrog-cli-core/v2 v2.55.6
+	github.com/jfrog/jfrog-cli-core/v2 v2.55.7
-	github.com/jfrog/jfrog-cli-security v1.7.2
+	github.com/jfrog/jfrog-cli-security v1.8.0

Might this 401 issue be due to updates of jfrog-cli(-core|-security)?

@anscfrisson
Copy link
Author

anscfrisson commented Sep 5, 2024

Plus searching for issues mentioning "The following error was received while trying to encrypt your password: Artifactory response: 401" in org jfrog reveals 2 issues besides this one:

@alexquitiaquez
Copy link

alexquitiaquez commented Oct 25, 2024

Hi,
I'm taking here my comment on issue94, because it's a related problem,

Source: #94 (comment)
We've been having the same issue recently in enterprise at the Post Download/Upload cleanup, here down some log,

Download Artefacts from Artifactory
...
Run jfrog/setup-jfrog-cli@v4
with:
download-repository: jfrog-cli-remote
version: 2.67.0
disable-job-summary: false
disable-auto-build-publish: false
env:
product-name: product-fake
component-name: xxxxxx-service
version: 1729012922-xxxxx
archive-extension: jar
artifact-path: artefact-release
project-name: ProductService
docker-registry-source: docker.registry.com
artifactory-url: https://artifacts.server.com
artifactory-serverid: artifactory
reports-format: ALL
ARTIFACTORY_API_KEY: ***
ARTIFACTORY_USER: ***
JF_URL: https://artifacts.artifacts.server.com/
JF_USER: ***
JF_PASSWORD: ***
Setup JFrog CLI
Downloading JFrog CLI from https://artifacts.artifacts.server.com/artifactory/jfrog-cli-remote/v2/2.67.0/jfrog-cli-linux-amd64/jfrog
/opt/hostedtoolcache/jf/2.67.0/x64/jf config add setup-jfrog-cli-server --url https://artifacts.artifacts.server.com/ --interactive=false --overwrite=true --user *** --password ***
[Warn] You are using JFrog CLI version 2.67.0, however version 2.71.1 is available.
To install the latest version, visit: https://jfrog.com/getcli
To see the release notes, visit: https://github.com/jfrog/jfrog-cli/releases
To avoid this message, set the JFROG_CLI_AVOID_NEW_VERSION_WARNING variable to TRUE
...

Post Download Artefacts from Artifactory
Post job cleanup.
Post job cleanup.
Checking connection to JFrog Artifactory
/opt/hostedtoolcache/jf/2.67.0/x64/jf rt ping
(https://github.com/Enterprise/xxxxxx-service/actions/runs/11521703694/job/32075950521#step:9:3):31 [Info] Trace ID for JFrog Platform logs: 4f3268f7c9abd8e7
Error: 1 [Error] the --url option is mandatory
Warning: An error occurred while trying to connect to Artifactory: Error: JFrog CLI exited with exit code 1. Skipping Build Info post tasks.
Cleanup JFrog CLI servers configuration
/opt/hostedtoolcache/jf/2.67.0/x64/jf c rm --quiet

JF_URL var is not empty at the Download step, but it seems it is empty an the Post job cleanup.

I guess it comes from this function checkConnectionToArtifactory at the cleanup.js, but we don't understand why.
https://github.com/jfrog/setup-jfrog-cli/blob/master/lib/cleanup.js#L163

function checkConnectionToArtifactory() {
    return __awaiter(this, void 0, void 0, function* () {
        try {
            core.startGroup('Checking connection to JFrog Artifactory');
            const pingResult = yield utils_1.Utils.runCliAndGetOutput(['rt', 'ping']);
            if (pingResult.trim() !== 'OK') {
                core.debug(`Ping result: ${pingResult}`);
                core.warning('Could not connect to Artifactory. Skipping Build Info post tasks.');
                return false;
            }
            return true;
        }
        catch (error) {
            core.warning(`An error occurred while trying to connect to Artifactory: ${error}. Skipping Build Info post tasks.`);
            return false;
        }
        finally {
            core.endGroup();
        }
    });
}

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants