tomasbjerre / git-changelog-command-line

Command line tool to generate changelog, or releasenotes, from a git repository and a Handlebars template.
Apache License 2.0
46 stars 13 forks source link

docker command line jira authentication issue #18

Open ryanammoury opened 2 months ago

ryanammoury commented 2 months ago

I'm able to authenticate on a Jenkins pipeline using the git-changelog-plugin this way :

    withCredentials([usernamePassword(credentialsId: atlassianCredentialsId, passwordVariable: 'JIRA_PASSWORD', usernameVariable: 'JIRA_USERNAME')]) {
        def templateString = readFile(file: templateFile)
        def changelogString = gitChangelog(from: [type: 'COMMIT', value: sinceCommit],
            jira: [issuePattern: '([A-Z]+-[0-9]+)', server: 'https://my-site.atlassian.net', username: env.JIRA_USERNAME, password: env.JIRA_PASSWORD],
            returnType: 'STRING',
            template: templateString)

However I'm not able to authenticate with the same server and credentials using docker command line

docker run --mount src="$(pwd)",target=/home/git-changelog-command-line,type=bind tomasbjerre/git-changelog-command-line:2.2.2 \
    --from-revision $1 \
    -je \
    --jira-pattern "([A-Z]+-[0-9]+)" \
    --jira-server "https://my-site.atlassian.net" \
    --jira-username "jirausername" \
    --jira-password "jirapassword" \
    -std \
    --template-content "$changelog_template"

The resulting changelogs are similar, except I'm not getting the Jira Issue Type, Title and other info using the docker command line. Any idea of what I might be doing wrong ?

tomasbjerre commented 2 months ago

Can you ping my-site.atlassian.net from inside your Docker container? I'm thinking there might be a networking issue with Docker.

ryanammoury commented 2 months ago

Hi @tomasbjerre, thanks for your quick answer.

I was able to ping www.google.com from inside the Docker container, but altlassian.net doesn't answer to ping. We can see that an IP address is correctly resolved though (185.166.141.3) :

>ping squadrone-system.atlassian.net
PING my-site.atlassian.net (185.166.141.3): 56 data bytes
^C
--- atlassian.net ping statistics ---
4 packets transmitted, 0 packets received, 100% packet loss
ryanammoury commented 2 months ago

I tried using npx and I have the same result. Is there a way I can debug authentication ?

I can authenticate on my-site.atlassian.net correctly using curl and a basic example with my Jira API Token.

tomasbjerre commented 2 months ago

Easiest way to debug is probably to find a test in the library and run that in debug mode with some IDE. Perhaps: https://github.com/tomasbjerre/git-changelog-lib/blob/master/src/test/java/se/bjurr/gitchangelog/internal/integrations/jira/JiraClientIntegrationTest.java