Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

skaffold doesn't work from gitlab-runner user #5719

Closed
FreddieMcHeart opened this issue Apr 23, 2021 · 4 comments
Closed

skaffold doesn't work from gitlab-runner user #5719

FreddieMcHeart opened this issue Apr 23, 2021 · 4 comments
Labels
triage/needs-information Information requested

Comments

@FreddieMcHeart
Copy link

FreddieMcHeart commented Apr 23, 2021

Expected behavior

Actual behavior

Information

  • Skaffold version: v1.22.0
  • Operating system: ubuntu 20.04
  • Installed via: skaffold.dev
  • Contents of skaffold.yaml:
apiVersion: skaffold/v2beta14
kind: Config
metadata:
  name: cryptobot
profiles:
  - name: stage
    build:
      artifacts:
        - image: my-repo/bot
          docker:
            dockerfile: Dockerfile
            noCache: false
      local: {}
      tagPolicy:
        gitCommit:
          variant: AbbrevTreeSha
          prefix: v.alfa.2.
    deploy:
      kubectl:
        manifests:
          - yamles/*.yaml

Steps to reproduce the behavior

  1. Using a gitlab CI
  2. .gitlab-ci.yml
stages:
  - build
#  - deploy

Build and Publish to Stage:
  stage: build
  tags: [skaffold]
  script:
    - ls -al
    - skaffold run -p stage
  only:
    - RC
  1. After starting, this pipeline had an error:

parsing skaffold config: failed to apply profiles to config "cryptobot" defined in file "/home/gitlab-runner/builds/ZqTVFjA1/0/high-school-prod/cryptobot/skaffold.yaml". There's an issue with one of the profiles defined in config "cryptobot" in file "/home/gitlab-runner/builds/ZqTVFjA1/0/high-school-prod/cryptobot/skaffold.yaml"; refer to the documentation on how to author valid profiles: https://skaffold.dev/docs/environment/profiles/.

root@Skaffold:~# groups gitlab-runner gitlab-runner : gitlab-runner sudo docker
users permissions

If I go to the gitlab-runner home dir and then to project dir ~/builds/ZqTVFjA1/0/high-school-prod/cryptobot and start any skaffold command like skaffold run -p stage or skaffold build -p stage I have the error that i wrote above.

dir contents

-rw-rw-r--  1 gitlab-runner gitlab-runner   81 Apr 22 22:56 .dockerignore
drwxrwxr-x  5 gitlab-runner gitlab-runner 4096 Apr 23 14:51 .git
-rw-rw-r--  1 gitlab-runner gitlab-runner  301 Apr 21 21:53 .gitignore
-rw-rw-r--  1 gitlab-runner gitlab-runner  160 Apr 22 22:16 .gitlab-ci.yml
-rw-rw-r--  1 gitlab-runner gitlab-runner  455 Apr 23 14:51 Dockerfile
-rw-rw-r--  1 gitlab-runner gitlab-runner  156 Apr 21 21:53 README.md
drwxrwxr-x  2 gitlab-runner gitlab-runner 4096 Apr 21 21:53 aggregation
drwxrwxr-x  2 gitlab-runner gitlab-runner 4096 Apr 21 21:53 bot
-rw-rw-r--  1 gitlab-runner gitlab-runner   10 Apr 21 21:53 change-generator.md
drwxrwxr-x  2 gitlab-runner gitlab-runner 4096 Apr 22 22:00 elastic
drwxrwxr-x  2 gitlab-runner gitlab-runner 4096 Apr 21 21:53 fetchers
-rw-rw-r--  1 gitlab-runner gitlab-runner  143 Apr 21 21:53 go.mod
-rw-rw-r--  1 gitlab-runner gitlab-runner 1044 Apr 21 21:53 go.sum
drwxrwxr-x  2 gitlab-runner gitlab-runner 4096 Apr 21 21:53 logic
-rw-rw-r--  1 gitlab-runner gitlab-runner  351 Apr 21 21:53 main.go
drwxrwxr-x  2 gitlab-runner gitlab-runner 4096 Apr 21 21:53 model
-rw-rw-r--  1 gitlab-runner gitlab-runner  459 Apr 22 22:16 skaffold.yaml
drwxrwxr-x  2 gitlab-runner gitlab-runner 4096 Apr 21 21:53 utils
drwxrwxr-x  2 gitlab-runner gitlab-runner 4096 Apr 23 14:51 yamles

@briandealwis briandealwis added the triage/needs-information Information requested label Apr 24, 2021
@briandealwis
Copy link
Member

Hmm that file seems to work fine as is. But this comment string is odd:

      tagPolicy: #   Ah6)^kK,Hbn;J9E birzha

It suggests to me that the actual file content might be different — that it was possibly sanitized when you pasted the contents here.

If I go to the gitlab-runner home dir and then ...

Could you try skaffold fix? I find that reports problematic lines.

@FreddieMcHeart
Copy link
Author

I wrote that its work if I start skaffold run -p stage by root.

root@Skaffold:/home/gitlab-runner/builds/ZqTVFjA1/0/high-school-prod/cryptobot# skaffold run -p stage
Generating tags...
 - freddiemcheart/crypto-bot -> freddiemcheart/crypto-bot:v.alfa.2.d7fdb18
Checking cache...
 - freddiemcheart/crypto-bot: Not found. Building
Starting build...
Building [freddiemcheart/crypto-bot]...
Sending build context to Docker daemon  230.9kB
Step 1/16 : FROM golang:buster AS builder
 ---> cbf5edf38f6b

But if I do that by gitlab-runner user, I had an error:

gitlab-runner@Skaffold:~/builds/ZqTVFjA1/0/high-school-prod/cryptobot$ skaffold run -p stage
parsing skaffold config: failed to apply profiles to config "cryptobot" defined in file "/home/gitlab-runner/builds/ZqTVFjA1/0/high-school-prod/cryptobot/skaffold.yaml". There's an issue with one of the profiles defined in config "cryptobot" in file "/home/gitlab-runner/builds/ZqTVFjA1/0/high-school-prod/cryptobot/skaffold.yaml"; refer to the documentation on how to author valid profiles: https://skaffold.dev/docs/environment/profiles/.

skaffold fix by root and gitlab-runner:

gitlab-runner@Skaffold:~/builds/ZqTVFjA1/0/high-school-prod/cryptobot$ skaffold fix
config is already version skaffold/v2beta14

root@Skaffold:/home/gitlab-runner/builds/ZqTVFjA1/0/high-school-prod/cryptobot# skaffold fix
config is already version skaffold/v2beta14

@FreddieMcHeart
Copy link
Author

FreddieMcHeart commented Apr 24, 2021

I download last commit version and I pulled the latest version of skaffold and now the error message is explicit so I figured out what was the problem. Thank you for your timely help.

I`m closing the issue

@briandealwis
Copy link
Member

I’m sorry @FreddieMcHeart — I didn’t realize that it worked as for. Could you share what the error was? I’m puzzled as to how permissions may have been a factor here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triage/needs-information Information requested
Projects
None yet
Development

No branches or pull requests

2 participants