Here is an excerpt from my gitlab-ci.yml:
image: golang:1.9.2
variables:
BIN_NAME: example
ARTIFACTS_DIR: artifacts
GO_PROJECT: example
GOPATH: /go
before_script:
- mkdir -p ${GOPATH}/src/${GO_PROJECT}
- mkdir -p ${CI_PROJECT_DIR}/${ARTIFACTS_DIR}
- go get -u github.com/golang/dep/cmd/dep
- cp -r ${CI_PROJECT_DIR}/* ${GOPATH}/src/${GO_PROJECT}/
- cd ${GOPATH}/src/${GO_PROJECT}
This is for Linux. I need a Windows image that is configured for golang.
I tried the following:
image: golang:1.12.6-windowsservercore
The above is documented on docker hub.
But I get this error:
ERROR: Preparation failed: Error: No such image: golang:1.12.6-windowsservercore (executor_docker.go:182:0s) Will be retried in 3s ...
Please note that I am aware the before_script
will not work with this image but it should at least find the image.
The image you are trying to pull does exist on dockerhub, but as stated in the golang documentation, the windowsservercore
is only available for gitlab-runner Docker executors that are running on Windows containers. The gitlab-runner that you are using is most likely a Docker executor running on a Linux machine.
You need to register a gitlab-runner in a Windows container with the Docker executor in order to be able to use the image golang:1.12.6-windowsservercore
.