在不接触 gitlab runner 的情况下,我可以仅使用 yml 添加基于标签的默认 docker 图像吗

Without touching gitlab runner, can I add a default docker image based on the tag, using only yml

test-java:
  stage: test
  image: gradle:6.3.0-jdk11
  script:
    - gradle test
  tags:
    - linux 

有没有这样的可能:

tags:
   linux:
      image:  gradle:6.3.0-jdk11
test-java:
  stage: test
  script:
    - gradle test
  tags:
    - linux 

如果这个问题已经被问过,在搜索时找不到它,请提前致谢,请原谅我

这将有助于理解您为什么要这样做。标签主要用于 select 特定的跑步者,而不是图像 (https://docs.gitlab.com/ee/ci/yaml/#tags)。如果你只想指定你的图片一次,你可以在根级别使用 image 关键字:

image:  gradle:6.3.0-jdk11

stages:
  - test
    
test_java:
  stage: test
  script:
    - gradle test

可选,您可以使用变量:

variables:
  linux: gradle:6.3.0-jdk11

stages:
  - test
    
test_java:
  stage: test
  image: $linux
  script:
    - gradle test