Hi all,
How it possible on ci/cd ? i’am sure my repo is tagged by v1.0.3 , but anyway i getting this error (
go: gitlab.com/ngads-main/core@v1.0.3: unknown revision v1.0.3
Hi all,
How it possible on ci/cd ? i’am sure my repo is tagged by v1.0.3 , but anyway i getting this error (
go: gitlab.com/ngads-main/core@v1.0.3: unknown revision v1.0.3
Hi,
please share a screenshot of http://gitlab.com/ngads-main/core/-/tags … maybe the tag only exists locally and hasn’t been pushed yet.
Compare the local tags with the remote tags as follows.
Local:
git tag -l
Remote:
git ls-remote --tags origin
Combined:
TAG=v1.0.3
git tag -l | grep $TAG
git ls-remote --tags origin | grep $TAG
Cheers,
Michael
Hi,
hm, after re-reading what the job does, I’d say that it could be related to Go itself not updating its cache or ref.
Can you share the .gitlab-ci.yml config to see how this comes together?
Cheers,
Michael
- test
- docker
services:
- docker:dind
variables:
DOCKER_REPO: registry.gitlab.com
IMAGE_NAME: ng-parsers/redtube-gallery-grabber
CGO_ENABLED: 0
GOOS: linux
GOARCH: amd64
before_script:
- cp -r . /
# - 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client git -y )'
# - mkdir -p ~/.ssh
# - echo "$SSH_PRIVATE_KEY" | tr -d '\r' > ~/.ssh/id_rsa
# - chmod 700 ~/.ssh/id_rsa
# - eval "$(ssh-agent -s)"
# - ssh-add ~/.ssh/id_rsa
# - ssh-keyscan -H 'gitlab.com' >> ~/.ssh/known_hosts
# - export GIT_SSH_COMMAND="ssh -i ~/.ssh/id_rsa -o StrictHostKeyChecking=no"
test:
stage: test
image: golang:1.12
only:
- master
script:
- go test ./...
docker:
stage: docker
image: docker:latest
script:
- docker login $DOCKER_REPO -u gitlab-ci-token -p $CI_JOB_TOKEN
# Build image
- docker build -t $DOCKER_REPO/$IMAGE_NAME -f ./Dockerfile .
- docker push $DOCKER_REPO/$IMAGE_NAME
and Dockerfile
FROM golang:alpine as build
RUN apk add --no-cache ca-certificates
WORKDIR /
ADD . .
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 \
go build -ldflags '-extldflags "-static"' -o redtube-parser ./cmd
FROM scratch
COPY --from=build /etc/ssl/certs/ca-certificates.crt \
/etc/ssl/certs/ca-certificates.crt
COPY --from=build / /
ENTRYPOINT ["/redtube-parser"]
Hi,
ok, thanks. Then let’s try to test some parts.
Modify the script
section for the test
job to invoke go get
.
script:
- go get ./...
- go test ./...
Besides a Go specific question, is your project using Go modules already, or how do you manage specific dependencies?
Cheers,
Michael
same thing( and yes, i’m use go modules already, gitlab.com/ngads-main/core@v1.0.3
is go module too.
and this is go.mod
module gitlab.com/ng-parsers/redtube-gallery-grabber
go 1.12
require (
github.com/PuerkitoBio/goquery v1.5.0
github.com/jessevdk/go-flags v1.4.0
github.com/kr/pretty v0.1.0 // indirect
github.com/sirupsen/logrus v1.4.2
gitlab.com/ngads-main/core v1.0.3
go.mongodb.org/mongo-driver v1.2.0
golang.org/x/net v0.0.0-20190620200207-3b0461eec859 // indirect
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 // indirect
)
forgot to said, if it necessary, gitlab.com/ngads-main/core@v1.0.3 is private repo in same gitlab account
Ok, the dumb user in me just asks himself whether this works with a different tag in the repo, e.g. v1.0.2
… or we are seeing permission problems here. I cannot access these projects with my account, so they are private.
Hmm… its working, after i switched gitlab.com/ngads-main/core to public, but how to work with private…)
If these projects would exist in the same group, it would be working ootb iirc. Since they don’t trust each other, you’ll need to pass in specific API auth tokens.
https://docs.gitlab.com/ee/user/project/deploy_tokens/
https://docs.gitlab.com/ee/user/project/new_ci_build_permissions_model.html
Cheers,
Michael
Thanks a lot, i think i know now where to go)
@dnsmichi Hello, one of links you provided doesn’t work, I mean this one - https://docs.gitlab.com/ee/user/project/new_ci_build_permissions_model.html
I’ve got the same error while trying to get modules
, the only thing is that all the module located in the same group