Sonarqube web refreshes on login with admin credentials after starting sonarqube fresh

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
    I have used multiple versions only one was able to go through but it was an older version I believe it was: sonarqube:8.9.2-community or sonarqube:7.9.6-community I can’t remember but one worked flawlessly unfortunately I think the version is too old for the jenkins I am using maybe someone can tell me I am wrong and I can use that one.

  • how is SonarQube deployed: zip, Docker, Helm
    I am using docker, specifically docker-compose file on a GCP machine with all ports currently open I went crazy. I opened up port 9000 at first but now all ports are open ingress and egress. It did the same with port 9000 open and all ports open

  • what are you trying to achieve
    Simply just trying to run the docker container, open the webbrowser with the ip:9000 and login and go past the log in screen

  • what have you tried so far to achieve this
    I have tried multiple docker containers/images. I tried at first running it without docker compose so it was just the docker run command:

docker run sonarqube:lts 9000:90000

I ran multiple different versions of this all go up and running without errors but the login redirect persists.

I tried installing sonarqube directly on the machine with postgres and configuring the network and the postgres passwords and installing java all myself. This also was able to run sonarqube without errors, but login issue still persists.

I tried using docker compose I will post the docker-compose.yml file below. I have removed all volumes and images before installing a new version to make sure there isn’t any volume data that is persisting through different versions.

I tried using different browsers: firefox, safari, chrome, brave

all do the same.

I tried deleting cookies in all browsers, issue still persists

One important thing to note sometimes, especially during the docker run without the compose file the login would happen only after I spam admin/admin in the login password after numerous tries a reallly undeterministic amount the login would happen and it would ask me to reset the password. Unfortunately the same would happen at the reset password stage and an undeterministic amount of reseting the password would happen and eventually I would be able to see the dashboard. Of course if I logged out or went away from keyboard the issue would happen all over again.

Here is the docker-compose.yml file as promised (this has changed multiple times, this is just the state it was in after I gave up and came here):

version: "3"

services:
  sonarqube:
    image: sonarqube:9.3-community
    depends_on:
      - db
    environment:
      SONAR_JDBC_URL: jdbc:postgresql://db:5432/sonar
      SONAR_JDBC_USERNAME: sonar
      SONAR_JDBC_PASSWORD: sonar
    volumes:
      - sonarqube_data:/opt/sonarqube/data
      - sonarqube_extensions:/opt/sonarqube/extensions
      - sonarqube_logs:/opt/sonarqube/logs
    ports:
      - "9000:9000"
  db:
    image: postgres:12
    environment:
      POSTGRES_USER: sonar
      POSTGRES_PASSWORD: sonar
    volumes:
      - postgresql:/var/lib/postgresql
      - postgresql_data:/var/lib/postgresql/data

volumes:
  sonarqube_data:
  sonarqube_extensions:
  sonarqube_logs:
  postgresql:
  postgresql_data:

Do not share screenshots of logs – share the text itself (bonus points for being well-formatted)!

If anyone could please help me with this issue I am hoping that it will solve the jenkins error that I am getting when I am able to login to sonarqube, perhaps I am just using an outdated version of the sonarqube plugin on jenkins though. I am not sure, I am new to jenkins and new to installing sonarqube so I am sure both are probably incorrect. Please help, and thank you

Hey there.

First things first, you need to make sure you’re targeting SonarQube v9.9 LTS or v10.2 (the two currently supported versions of SonarQube).

I will try both and let you know!

So I changed the image to 10.2 and 9.9-community and both are causing the same issue. 9.9. interestingly enough only took two tries of typing admin/admin before allowing me to change the password, but after that it was looping with the change password

image: sonarqube:10.2-community

one thing to note as well is I am not getting the authentication incorrect toast when I type in incorrect creds

{
    "isLoggedIn": true,
    "login": "admin",
    "name": "Administrator",
    "local": true,
    "externalIdentity": "admin",
    "externalProvider": "sonarqube",
    "scmAccounts": [],
    "groups": [
        "sonar-administrators",
        "sonar-users"
    ],
    "permissions": {
        "global": [
            "admin",
            "gateadmin",
            "profileadmin",
            "provisioning",
            "scan"
        ]
    },
    "homepage": {
        "type": "PROJECTS"
    },
    "usingSonarLintConnectedMode": false,
    "dismissedNotices": {
        "educationPrinciples": false,
        "sonarlintAd": false,
        "issueCleanCodeGuide": false
    }
}

This is the “current” in the network tab of the webpage

it has the isLoggedInFlag: true

but I am still being redirected to the reset password when I type my new password

Can you try logging in on an entirely different browser than the one you typically use, or incognito mode? I wonder if an authentication cookie from logging into another instance is getting in the way.

I have tried multiple browsers. Like in my question I point out that in each of these browsers I have cleared cookies, disabled extensions everything you could possibly do for each. I use safari and firefox the most when testing this as I don’t use these browers often so it is not much of a hurt when I delete all cookies and website data from these browsers, but I have deleted all data from chromium browsers (brave, chrome) before and still the same issue persists.

when I type in my my browser the ip:9000 should it redirect to this url: http://34.170.163.246:9000/sessions/new?return_to=%2F

it adds /sessions/new?return_to=%2F

I think the %2F might have an issue???

WOOWWWWWWWWWWWWWWW changing the %2F to %2T makes it work

not sure if that was the issue. Just seemed to work after I did that, but after logging out and trying to log back in it refreshed a couple of times before letting me in