如何从BitBucket Pipeline启动声纳扫描器docker图像?

时间:2019-05-23 20:47:49

标签: docker sonarqube bitbucket bitbucket-pipelines sonarscanner

我必须从bitbucket运行已配置的声纳扫描仪。问题是我对所有这些都不熟悉:BitBucket,声纳扫描仪,泊坞窗,我需要以一种方式集成它们,从那时起,我只能从BitBucket运行声纳扫描仪,然后使用来自声纳的更高级分析扫描器。

我试图通过声纳扫描仪使用docker图像,但是没有建立它。因此,我直接从GitHub获得了它,但没有设法从bitbucket中使用它。

我看了看这个线程,但是它使用的是GitLab,尽管它与我需要的类似: Launching Sonar Scanner from a gitlab docker runner

bitbucket-pipelines.yml


# This is a sample build configuration for Docker.
# Check our guides at https://confluence.atlassian.com/x/O1toN for more examples.
# Only use spaces to indent your .yml configuration.
# -----
# You can specify a custom docker image from Docker Hub as your build environment.
image: atlassian/default-image:2

pipelines:
  default:
    - step:
        services:
          - docker
        script: # Modify the commands below to build your repository.
          # Set $DOCKER_HUB_USERNAME and $DOCKER_HUB_PASSWORD as environment variables in repository settings
          - export IMAGE_NAME=emeraldsquad/sonar-scanner:$BITBUCKET_COMMIT

          # build the Docker image (this will use the Dockerfile in the root of the repo)
          #RETURNS ERROR - docker build -t $IMAGE_NAME .
          # authenticate with the Docker Hub registry
          - docker login --username $DOCKER_HUB_USERNAME --password $DOCKER_HUB_PASSWORD
          # push the new Docker image to the Docker registry
          - docker push $IMAGE_NAME


0 个答案:

没有答案
相关问题