我必须从 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