openfaas / openfaas-cloud

The Multi-user OpenFaaS Platform
https://docs.openfaas.com/openfaas-cloud/intro/
MIT License
770 stars 227 forks source link

OFaaS Cloud can't find `openfaas-cloud` tag GitLab #496

Closed bendermIBM closed 5 years ago

bendermIBM commented 5 years ago

OpenFaas cloud can't seem to see the openfaas-cloud tag on a GitLab repository even though it is clearly there when querying the API.

Expected Behaviour

Project should build in an OpenFaas Cloud pipeline

Current Behaviour

GitLab event is returning an error.

To install project on the openfaas-cloud instance add "openfaas-cloud" tag

However when querying the project in question we can see the tag

{
   "id":2,
   "description":"",
   "name":"project-00",
   "name_with_namespace":"User00 / project00",
   "path":"project-00",
   "path_with_namespace":"user00/project00",
   "created_at":"2019-08-13T17:35:47.141Z",
   "default_branch":"master",
   "tag_list":[
      "openfaas-cloud"
   ],
   "ssh_url_to_repo":"gitlaburlt",
   "http_url_to_repo":"gitlaburl",
   "web_url":"gitlaburl",
   "readme_url":"gitlaburl",
   "avatar_url":null,
   "star_count":0,
   "forks_count":0,
   "last_activity_at":"2019-08-14T22:37:50.629Z",
   "namespace":{
      "id":34,
      "name":"Project00",
      "path":"project00",
      "kind":"user",
      "full_path":"project00",
      "parent_id":null,
      "avatar_url":"https://secure.gravatar.com/avatar/b75dcc2af3161d57680eb3be5d2bf20c?s=80\u0026d=identicon",
      "web_url":"gitlaburl"
   }
}

Possible Solution

Maybe a cert issue but as far as I can see everything can reach gitlab without a problem.

Steps to Reproduce (for bugs)

Install most recent GitLab CE from charts and then install OpenFaas via Helm Charts and OpenFaas Cloud via helm charts after that. Attempted to use ofc-bootstrap tool but the uninstall scripts completely broke one of our k8s cluster by removing the cert-manager namespace which other services relied on.

Context

Trying to setup a CICD Pipeline using OpenFaas Cloud via GitLab as an SCM

Your Environment

Docker version 18.06.2-ce

Kubernetes

Linux on Z (s390x) - RHEL 7

https://github.com/openfaas/faas/blob/master/guide/troubleshooting.md doesn't exist... getting a 404

alexellis commented 5 years ago

Hi @bendermIBM

I see that you sneaked in that little detail that you're using s390x :crown: - I don't think anyone has used this platform for OpenFaaS yet.

We do have Risc-V, ARM32/64 and Power though -> https://www.youtube.com/watch?v=hhlqA78V8Jo

I'm not sure what problem you may be running into with GitLab, but I wonder if the access secret is available and correct, so that the system-gitlab-event/gitlab-push function can check for the tag on the repo?

As far as I'm aware the tag code is working properly and hasn't changed recently.

This is the code which is executing: https://github.com/openfaas/openfaas-cloud/blob/master/gitlab-event/handler.go#L306

@martindekov wrote this, but I'm running it with GitLab on my own server and it's working there.

I wonder if an API changed perhaps? Can you do some diagnostics and debugging?

Alex

alexellis commented 5 years ago

/msg: slack

derek[bot] commented 5 years ago

-- Join Slack to connect with the community https://docs.openfaas.com/community

bendermIBM commented 5 years ago

Hey @alexellis thanks for the response!

I see that you sneaked in that little detail that you're using s390x 👑 - I don't think anyone has used this platform for OpenFaaS yet.

Yup we are attempting to get a POC of OpenFaaS running on s390x to work out any kinks. As with many of the OpenSource tech that my team tries to get running on Linux on Z, it is the first time anyone has tried to get it running. Where's the fun without some challenges 👍

Soon, when we have some more parts in place, I plan on starting a conversation with the community about s390x support. Not quite ready for that conversation yet...

I'm not sure what problem you may be running into with GitLab, but I wonder if the access secret is available and correct, so that the system-gitlab-event/gitlab-push function can check for the tag on the repo?

Will check...

I wonder if an API changed perhaps? Can you do some diagnostics and debugging?

Yeah I've been doing a bunch of this executing into containers across the K8s environment making sure things can talk to each-other. I will continue to hack on it and see what I can find.

Join Slack to connect with the community https://docs.openfaas.com/community

I submitted a request to join the community! Would love to chat w/ y'all and start interacting and getting involved with commits and ports.

alexellis commented 5 years ago

I've just expedited your invite as they are normally sent every morning by one of the Core team.

openfaas-cloud and #kubernetes are probably the channels you want to join

I can also give you access to my private GitLab instance which is connected to OFC if it's helpful.

alexellis commented 5 years ago

I'm seeing a private token being added as a header:

https://github.com/openfaas/openfaas-cloud/blob/master/gitlab-event/handler.go#L313

Can you check if that is configured correctly for your container and as a secret in Kubernetes?

The secret is gitlab-api-token - and that has to match the one on your GitLab instance.

There are some supplementary docs for this here: https://docs.openfaas.com/openfaas-cloud/self-hosted/gitlab/

martindekov commented 5 years ago

Hello @bendermIBM Can you send a picture in the UI of GitLab, there was always confusion around tags as there are two places in which you can add a tag and they mean separate things, I believe the latest GitLab instances have changed the tag naming to label or something IF I am not mistaken. Need to double check.

martindekov commented 5 years ago

Either way I believe we should refer that in the documentation, when I verify what the new naming is.

martindekov commented 5 years ago

So I believe you should add topic and not tag refer to this issue on naming change. If you are able to make it work with adding instead of tag, a topic, please let me know and I will reflect this in the documentation :+1:

alexellis commented 5 years ago

Here is a tag example from what may be an earlier version of GitLab:

tag-example

bendermIBM commented 5 years ago

Hey @martindekov I am running GitLab Community Edition 12.1.4 currently but there is a prompt for an upgrade (however that might make it worse if the APIs have been changed)

So I believe you should add topic and not tag refer to this issue on naming change.

I noticed this too. GitLab has seemingly changed the wording from tag to topic I think tags as GitLab now knows seem to equate to a GitHub release : Tagging your master branch at a certain point will snapshot that code to be downloaded later

With my example I have assumed that topics are equal to tags in previous GitLab releases. I tried and checking the official GitLab but they have also already upgraded to 12.X and I see the same thing there.

This is what I now see when creating a project

Screen Shot 2019-08-20 at 12 51 54 PM

Afterwords I can edit the project settings and add in this topic

Screen Shot 2019-08-20 at 1 08 09 PM


Creating a Tag

So now when creating a tag it looks like this Screen Shot 2019-08-20 at 1 12 38 PM

Screen Shot 2019-08-20 at 1 12 44 PM


Topic == Tag for API?

It seems like when querying the API however there is still a section for the tag (which is actually now a topic on the UI)

{
   "id":4,
   "description":"",
   "name":"project-00",
   "name_with_namespace":"User00 / project00",
   "path":"project-00",
   "path_with_namespace":"user00/project00",
   "created_at":"2019-08-13T17:35:47.141Z",
   "default_branch":"master",
   "tag_list":[
      "openfaas-cloud"
   ],
   "ssh_url_to_repo":"gitlaburl",
   "http_url_to_repo":"gitlaburl",
   "web_url":"gitlaburl",
   "readme_url":"gitlaburl",
   "avatar_url":null,
   "star_count":0,
   "forks_count":0,
   "last_activity_at":"2019-08-14T22:37:50.629Z",
   "namespace":{
      "id":34,
      "name":"Project00",
      "path":"project00",
      "kind":"user",
      "full_path":"project00",
      "parent_id":null,
      "avatar_url":"https://secure.gravatar.com/avatar/b75dcc2af3161d57680eb3be5d2bf20c?s=80\u0026d=identicon",
      "web_url":"gitlaburl"
   }
bendermIBM commented 5 years ago

@alexellis @martindekov so it does look like maybe OF documentation needs to be updated to reflect topics but my issue was in fact the access key to GitLab. I had the access key set up as directed here but it was an access key for the root user which for whatever reason can’t be used for those projects. Created a new user and a new project - added and access token for that user and the project looks to be processing now via gitlab-push

Push - {refs/heads/master {PROJECT00 USER00/PROJECT00 GITLABURL false 0 GITLABURL {Project00  0}} 2b1e4fe00350695a589f93f70f1ac36e8e0698d2 {4} gitlab}, git-tar status: 202
2019/08/20 17:35:54 Duration: 0.795491 seconds

@alexellis want me to open up another issue for OF documentation re topic vs tag or has that action been recorded elsewhere?

alexellis commented 5 years ago

@bendermIBM can you share a screenshot of the root user's API key? You may have been missing the "sudo" / impersonation level of access.

bendermIBM commented 5 years ago

@alexellis Screen Shot 2019-08-20 at 2 00 57 PM

New one

Screen Shot 2019-08-20 at 2 02 12 PM

alexellis commented 5 years ago

Note added to the GitLab docs in this repository. There was nothing in openfaas/docs.