Gitlab 作业未拉取 Docker 图像

Gitlab job not pulling Docker image

运行 使用我创建的 Docker 图像的 Gitlab 项目。

问题:Gitlab 作业执行日志显示图像未被拉取。 这是 .gitlab-ci.yml 文件,删除了公司内容:

default:
  image:
    name: guythedocker/jmeter-mssql-windows:latest
    entrypoint: [""]

api test:
  stage: test
  script:
    - get-variable
    - $env:path -split ";"
    - echo $WORKDIR
    - Get-ChildItem  -Path / -File
    - entrypoint.ps1 --version
    - |
      /entrypoint.ps1 -n -t ./JMeter/xxx.jmx -l ./xxx.log -e -o ./testresults/xxx-Jthreads=$xx-Jrampup=$xxx -JtestCases=$xxx -Jhost=xxx.com -f 

  retry: 2

  only:
    - schedules
  artifacts:
    paths:
      - testresults
  tags:
   - win2019

这是 Docker 文件,它基本上是从 QAInsights 的 Docker 文件中复制的:

# Dockerfile for Apache JMeter for Windows
# Indicates that the windowsservercore along with OpenJDK will be used as the base image.
# Based on work by NaveenKumar Namachivayam 
FROM openjdk:8-windowsservercore

ARG JMETER_VERSION="5.4.3"
ENV JMETER_HOME /apache-jmeter-$JMETER_VERSION/apache-jmeter-$JMETER_VERSION/

# Metadata indicating an image maintainer.
LABEL maintainer="Guy L."

# Downloads JMeter from one of the mirrors, if you prefer to change, you can change the URL
RUN Invoke-WebRequest -URI https://archive.apache.org/dist/jmeter/binaries/apache-jmeter-$env:JMETER_VERSION.zip \
-UseBasicParsing -Outfile /apache-jmeter-$env:JMETER_VERSION.zip

# Extract the downloaded zip file
RUN Expand-Archive /apache-jmeter-$env:JMETER_VERSION.zip -DestinationPath /apache-jmeter-$env:JMETER_VERSION

# For JDBC
RUN Invoke-WebRequest -URI https://repo1.maven.org/maven2/com/microsoft/sqlserver/mssql-jdbc/9.4.1.jre8/mssql-jdbc-9.4.1.jre8.jar -Outfile mssql-jdbc-9.4.1.jre8.jar 
RUN Invoke-WebRequest -URI https://repo1.maven.org/maven2/com/microsoft/sqlserver/mssql-jdbc_auth/9.4.1.x86/mssql-jdbc_auth-9.4.1.x86.dll -Outfile mssql-jdbc_auth-9.4.1.x86.dll
    
COPY ./mssql-jdbc-9.4.1.jre8.jar ${JMETER_HOME}/lib/
COPY ./mssql-jdbc_auth-9.4.1.x86.dll ${JMETER_HOME}/lib/

# Copies the entrypoint.ps1
COPY /entrypoint.ps1 /entrypoint.ps1
COPY /jmeter-plugins-install.ps1 /jmeter-plugins-install.ps1

RUN ["powershell.exe","/jmeter-plugins-install.ps1"]
# Sets the Working directory
WORKDIR ${JMETER_HOME}/bin

# Sets a command or process that will run each time a container is run from the new image. For detailed instruction, go to entrypoint.ps1 file.
ENTRYPOINT ["powershell.exe", "/entrypoint.ps1"]

图像是 successfully published

那为什么我的 Gitlab 项目没有拉取这个镜像呢?

它是一个 Windows 跑步者(因为我使用的是 -tag,正如我在作业历史记录中看到的那样)。

您的 运行ner 配置为使用 shell 执行程序(正如您在打印屏幕的第 3 行中看到的那样)但是对于 运行 Docker 图像,您必须使用 dockerdocker-windows executor(取决于您想要 运行 的容器是基于 Linux 还是 Windows)。