I am close to achieve a complete (without testing stage) continuous integration in Gitlab with a Golang software.
It fails when I am trying to build the Docker image at the docker login
step.
Here is my .gitlab-ci.yml
:
stages:
- build
variables:
REGISTRY: registry.gitlab.com
GO_PROJECT: mysoftware
build_golang_binary:
image: golang:latest
stage: build
before_script:
- mkdir -p ${GOPATH}/src/${GO_PROJECT}
- cp -r ${CI_PROJECT_DIR}/* ${GOPATH}/src/${GO_PROJECT}/
- cd ${GOPATH}/src/${GO_PROJECT}
- go get
script:
- cd ${GOPATH}/src/${GO_PROJECT}
- go build
build_docker_image:
image: docker:latest
stage: build
script:
- docker login $REGISTRY
- docker build --no-cache -t ${REGISTRY}/me/${GO_PROJECT} .
- docker push ${REGISTRY}/me/${GO_PROJECT}
Here is the error I am getting : $ docker login $REGISTRY
Error: Cannot perform an interactive login from a non TTY device
I thought that the credentials would be provided into this CI process.. Apparently, they are not.
What is the best option to solve this ?