Git-bug: Part 2

Published: Dec 14, 2022 by Isaac Johnson

In our last post, we took at look at installing Git-Bug as well as it’s basic flow. We saw termui and webui.

Today we ‘ll refresh ourselves on the git-bug flow, then try containerizing the webui. The other path we’ll checkout for syncing bugs is using the bridge feature to link to Github, Gitlab and JIRA.

Beware that this particular blog covers a lot of what doesn’t work, almost works, and works in a jenky way. All of this uses the 0.7.2 release of git-bug unless otherwise noted.

Using Git-bug on a real project

I’ll go to my blog repo to get started.

Let’s create our user first

builder@DESKTOP-72D2D9T:~/Workspaces/jekyll-blog$ git bug user create
Building identity cache... Done.
Building bug cache... Done.
Name [Isaac Johnson]: 
Email [isaac.johnson@gmail.com]: 
Avatar URL: http://freshbrewed-test.s3-website-us-east-1.amazonaws.com/content/images/2022/11/isaacjohnson_a_large_golden_crown_over_three_smaller_pincess_je_c5411c3e-f671-4f24-9b9b-9df6ceba161d.png

e4543e7950cac0cb4f77cc234ab28404f980e6fd

$ git bug user ls
e4543e7 Isaac Johnson

Let’s now push that identity

builder@DESKTOP-72D2D9T:~/Workspaces/jekyll-blog$ git bug ls
a90ce46 open    Blog - Py Func with REST API                            Isaac Johnson      1 💬
builder@DESKTOP-72D2D9T:~/Workspaces/jekyll-blog$ git bug termui
builder@DESKTOP-72D2D9T:~/Workspaces/jekyll-blog$ git bug push
To https://github.com/idjohnson/jekyll-blog.git
 * [new branch]      refs/identities/e4543e7950cac0cb4f77cc234ab28404f980e6fd -> refs/identities/e4543e7950cac0cb4f77cc234ab28404f980e6fdTo https://github.com/idjohnson/jekyll-blog.git
 * [new branch]      refs/bugs/a90ce4694faa52954847ade343d783c535e6f717 -> refs/bugs/a90ce4694faa52954847ade343d783c535e6f717
builder@DESKTOP-72D2D9T:~/Workspaces/jekyll-blog$ git bug termui
builder@DESKTOP-72D2D9T:~/Workspaces/jekyll-blog$ git bug push
Everything up-to-dateTo https://github.com/idjohnson/jekyll-blog.git
 * [new branch]      refs/bugs/6b9f0e9a1334c7291e6fc87bffd245189b30d3a1 -> refs/bugs/6b9f0e9a1334c7291e6fc87bffd245189b30d3a1

Our repo now has a basic identity set.

Containerizing

I had the idea that maybe this would be fun to containerize the webui.

I started with a Dockerfile in my repo

FROM alpine

RUN apk add --update
RUN apk update
RUN apk add git curl

RUN apk add -f install acl dirmngr gpg lsof procps wget netcat gosu tini; \
  curl -O https://github.com/MichaelMure/git-bug/releases/download/v0.7.2/git-bug_linux_amd64; \
  chmod 755 ./git-bug_linux_amd64; \
  mv ./git-bug_linux_amd64 /usr/local/bin/git-bug

copy . .

CMD ["git","bug webui --port 4000 --no-open"]

I struggled with curl actually pulling from github releases. In the end, I used wget.

Also, teasing out the CMD vs ENTRYPOINT was a challenge in that, for some inexplicable reason, Docker itself failed to port forward (Kubernetes was fine, though). I was convinced, for some time, that there was a UFW in place blocking ports.

Once I setup the Dockerfile and Entrpoint:

$ cat Dockerfile
FROM ubuntu

RUN apt update
RUN apt install -y git curl

COPY git-bug_linux_amd64 /usr/local/bin/git-bug

RUN chmod 755 /usr/local/bin/git-bug

copy .git .git
copy entrypoint.sh entrypoint.sh

#ENTRYPOINT ["tail", "-f", "/dev/null"]
ENTRYPOINT ["/bin/bash","entrypoint.sh"]

$ cat entrypoint.sh
#!/bin/bash -x
/usr/local/bin/git-bug webui --port 4000 --no-open

Then I could push to Harbor:

$ docker tag gbwebui10 harbor.freshbrewed.science/freshbrewedprivate/testwebui10
$ docker push harbor.freshbrewed.science/freshbrewedprivate/testwebui10

Which I can see in Harbor

/content/images/2022/12/gitbug-19.png

I could then use that image in a deployment and service

$ cat ~/bgwebui.dep.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: gbwebui
spec:
  selector:
    matchLabels:
      run: gbwebui
  replicas: 1
  template:
    metadata:
      labels:
        run: gbwebui
    spec:
      containers:
      - name: gbwebui
        image: harbor.freshbrewed.science/freshbrewedprivate/testwebui10:latest
        ports:
        - containerPort: 4000
      imagePullSecrets:
      - name: myharborreg
---
apiVersion: v1
kind: Service
metadata:
  name: gbwebui
  labels:
    run: gbwebui
spec:
  ports:
  - name: http
    port: 8888
    protocol: TCP
    targetPort: 4000
  selector:
    run: gbwebui

builder@DESKTOP-72D2D9T:~$ kubectl apply -f bgwebui.dep.yaml
deployment.apps/gbwebui created
service/gbwebui created

Now I can test

builder@DESKTOP-72D2D9T:~$ kubectl get pods | grep webui
gbwebui-7d8986b8b8-kmt7p                                 1/1     Running            0                  108s
builder@DESKTOP-72D2D9T:~$ kubectl port-forward gbwebui-7d8986b8b8-kmt7p 8080:4000
Forwarding from 127.0.0.1:8080 -> 4000
Forwarding from [::1]:8080 -> 4000
Handling connection for 8080
Handling connection for 8080
Handling connection for 8080

/content/images/2022/12/gitbug-20.png

Attempting to expose externally

Of course, I can now expose that to the world if I want. (note: I ended up having some ingress issues, but you see the general pattern below)

$ cat r53-gbwebui.json
{
  "Comment": "CREATE gbwebui fb.s A record",
  "Changes": [
    {
      "Action": "CREATE",
      "ResourceRecordSet": {
        "Name": "gbwebui.freshbrewed.science",
        "Type": "A",
        "TTL": 300,
        "ResourceRecords": [
          {
            "Value": "73.242.50.46"
          }
        ]
      }
    }
  ]
}

$ aws route53 change-resource-record-sets --hosted-zone-id Z39E8QFU0F9PZP --change-batch file://r53-gbwebui.json
{
    "ChangeInfo": {
        "Id": "/change/C07108643JHHF87Z57WE6",
        "Status": "PENDING",
        "SubmittedAt": "2022-12-03T16:00:50.886Z",
        "Comment": "CREATE gbwebui fb.s A record"
    }
}

I can add the Ingress and apply it

$ cat ingress.gbwebui.yaml
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  annotations:
    cert-manager.io/cluster-issuer: letsencrypt-prod
    kubernetes.io/tls-acme: "true"
    nginx.ingress.kubernetes.io/add-base-url: "true"
    nginx.ingress.kubernetes.io/app-root: /
    nginx.ingress.kubernetes.io/rewrite-target: /
  name: gbwebui
  namespace: default
spec:
  ingressClassName: nginx
  rules:
  - host: gbwebui.freshbrewed.science
    http:
      paths:
      - backend:
          service:
            name: gbwebui
            port:
              number: 8888
        path: /
        pathType: ImplementationSpecific
  tls:
  - hosts:
    - gbwebui.freshbrewed.science
    secretName: gbwebui-tls
    
$ kubectl apply -f ingress.gbwebui.yaml
ingress.networking.k8s.io/gbwebui created

$ kubectl get ingress gbwebui
NAME      CLASS   HOSTS                         ADDRESS                                                PORTS     AGE
gbwebui   nginx   gbwebui.freshbrewed.science   192.168.1.214,192.168.1.38,192.168.1.57,192.168.1.77   80, 443   57s

I tried a few annotations;

builder@DESKTOP-72D2D9T:~/Workspaces/jekyll-blog$ kubectl apply -f ingress.gbwebui.yaml
ingress.networking.k8s.io/gbwebui created
builder@DESKTOP-72D2D9T:~/Workspaces/jekyll-blog$ cat ingress.gbwebui.yaml
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  annotations:
    cert-manager.io/cluster-issuer: letsencrypt-prod
    kubernetes.io/ingress.class: nginx
    kubernetes.io/tls-acme: "true"
  name: gbwebui
  namespace: default
spec:
  rules:
  - host: gbwebui.freshbrewed.science
    http:
      paths:
      - backend:
          service:
            name: gbwebui
            port:
              number: 8888
        path: /
        pathType: ImplementationSpecific
  tls:
  - hosts:
    - gbwebui.freshbrewed.science
    secretName: gbwebui-tls

However, despite all my testing, I couldn’t get traffic to route. I question if this is an issue with my on-prem cluster more than anything.

Git Bug Bridge

Let’ set up a bridge.

We have a few choices from which to pick:

$ git bug bridge configure help
[1]: github
[2]: gitlab
[3]: jira
[4]: launchpad-preview
target:

Github

First, I tried Github Interactive

$ git bug bridge configure
[1]: github
[2]: gitlab
[3]: jira
[4]: launchpad-preview
target: 1
name [default]:

Detected projects:
[1]: github.com/idjohnson/jekyll-blog

[0]: Another project

Select option: 1
Github login: idjohnson

[1]: enter my token
[2]: interactive token creation

Select option: 2

git-bug will now generate an access token in your Github profile. Your credential are not stored and are only used to generate the token. The token is stored in the global git config.

The access scope depend on the type of repository.
Public:
  - 'public_repo': to be able to read public repositories
Private:
  - 'repo'       : to be able to read private repositories

[1]: public
[2]: private
repository visibility: 2

Password:
Error: error creating token 404: {"message":"Not Found","documentation_url":"https://docs.github.com/rest"}

I then tried a fresh token I created; that too failed

builder@DESKTOP-72D2D9T:~/Workspaces/jekyll-blog$ git bug bridge configure
[1]: github
[2]: gitlab
[3]: jira
[4]: launchpad-preview
target: 1
name [default]:

Detected projects:
[1]: github.com/idjohnson/jekyll-blog

[0]: Another project

Select option: 1
Github login: isaac.johnson@gmail.com
invalid login
Github login: idjohnson

[1]: enter my token
[2]: interactive token creation

Select option: 1

You can generate a new token by visiting https://github.com/settings/tokens.
Choose 'Generate new token' and set the necessary access scope for your repository.

The access scope depend on the type of repository.
Public:
  - 'public_repo': to be able to read public repositories
Private:
  - 'repo'       : to be able to read private repositories

Enter token: ghp_****typed it in here****Pn
token has incorrect format
Enter token:

I also had no luck with JIRA

$ git bug bridge configure
[1]: github
[2]: gitlab
[3]: jira
[4]: launchpad-preview
target: 3
name [default]:
JIRA server URL: https://freshbrewed.atlassian.net/jira
JIRA project key: TPK

JIRA has recently altered it's authentication strategies. Servers deployed
prior to October 1st 2019 must use "SESSION" authentication, whereby the REST
client logs in with an actual username and password, is assigned a session, and
passes the session cookie with each request. JIRA Cloud and servers deployed
after October 1st 2019 must use "TOKEN" authentication. You must create a user
API token and the client will provide this along with your username with each
request.
[1]: SESSION
[2]: TOKEN
Authentication mechanism: 1

JIRA login: isaac@freshbrewed.science

[1]: enter my password
[2]: ask my password each time

Select option: 1

Password:
Attempting to login with credentials...
Error: error creating token 404: <!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><title>Oops, you&#39;ve found a dead link. - JIRA</title><link type='text/css' rel='stylesheet' href='/static-assets/metal-all.css' media='all'><scrip
....snip....

Doing Github inline however, worked just dandy

$ git bug bridge configure --name=myghbridge --target=github --token=ghp_*******token here*******n --url=https://github.com/idjohnson/jekyll-blog
Current identity e4543e7 tagged with login idjohnson
Successfully configured bridge: myghbridge

Now I’ll pull in my GH issues as new bugs

builder@DESKTOP-72D2D9T:~/Workspaces/jekyll-blog$ git bug bridge pull
new issue: 44ba9a12a91bee59281597f6fdd48463b27d9e90
changed status: 86d4ff52d54b2253daf078da3c93fb940fcd7242100ebfe89c96c55f5d738009
new issue: d5a8c33f6f4758b0acb56ab1eb91ae59a1faf4b7
changed label: d24dd0a881f0a09c9f8744aa397b1278805ac5f63e3aa0ff2401af03dcede16a
new issue: 1b6b93eed06e07155f08975e7f35c32dc853d75e
changed label: 63f9a4d6c046cf7997696a181dfec4844004ab38aee6ab1a7f7d67cb0ae2c669
new comment: 5423189be64516e9f2ec7e27132a25c278ccbd4417203051da036b09d8a13d17
new issue: 6bc048ea4fb968293b2d751dc9a29c575bbf04c4
changed status: 8332753d67248d4279bb5da1460d5a1c8025a6f9202411993d04e1cdda5dcfa4
new issue: ec1304505c4f18bf603eee2c2d7bcba3653fcb5a
new issue: a6a20546e817c8c0a5ace851c7960c215a6e360b
imported 6 issues and 0 identities with myghbridge bridge

And I can see it with termui

/content/images/2022/12/gitbug-21.png

Next, I can push all the git bug issues back up into Github

builder@DESKTOP-72D2D9T:~/Workspaces/jekyll-blog$ git bug bridge push
new issue: a90ce4694faa52954847ade343d783c535e6f717
updated comment: b7489ee943f20a905648065fcc7be5ffde5119e04ad45eb1fbe7fec1f1098c15
new issue: 6b9f0e9a1334c7291e6fc87bffd245189b30d3a1
updated comment: 74486ce4a77bdec337614890df2d30682a87b2ab2dda301338f3eaa4800868ed
new issue: 60544c6ee6a89ec70f3c3b6b254ae8effa31413e
updated comment: b0c216dbc291b580f25f54cea3c4774eaa752eebc07b553c25ac7df3c7d9a437
exported 3 issues with myghbridge bridge

And I can see them all in Github

/content/images/2022/12/gitbug-22.png

I realized there were custom tags I used in Github. Were they also in Gitbug?

I refired up termui and saw that yes, indeed, the labels sync

/content/images/2022/12/gitbug-23.png

Pivot to local JIRA

I decided to then do a local install of JIRA just in case the hosted Atlassian isn’t supported

After downloading and launching a local JAR based JIRA DataCenter edition. After the wizard fetched me a trial license, i could finish the setup

/content/images/2022/12/gitbug-33.png

Then I created a project, TPK.

/content/images/2022/12/gitbug-34.png

That failed. However, when I removed secure I made progress

builder@DESKTOP-72D2D9T:~/Workspaces/jekyll-blog$ git bug bridge configure --name=localjira --target=jira
JIRA server URL: http://localhost:8080
JIRA project key: TPK

JIRA has recently altered it's authentication strategies. Servers deployed
prior to October 1st 2019 must use "SESSION" authentication, whereby the REST
client logs in with an actual username and password, is assigned a session, and
passes the session cookie with each request. JIRA Cloud and servers deployed
after October 1st 2019 must use "TOKEN" authentication. You must create a user
API token and the client will provide this along with your username with each
request.
[1]: SESSION
[2]: TOKEN
Authentication mechanism: 1

JIRA login: isaac

[1]: enter my password
[2]: ask my password each time

Select option: 1

Password:
Attempting to login with credentials...
Checking project ...
Current identity e4543e7 tagged with login isaac

NOTE: There are a few optional configuration values that you can additionally
set in your git configuration to influence the behavior of the bridge. Please
see the notes at:
https://github.com/MichaelMure/git-bug/blob/master/doc/jira_bridge.md
Successfully configured bridge: localjira

I got the initial errors on push about Epic being required

builder@DESKTOP-72D2D9T:~/Workspaces/jekyll-blog$ git bug bridge push localjira
export error at 60544c6ee6a89ec70f3c3b6b254ae8effa31413e: exporting jira issue: HTTP response 400, query was http://localhost:8080/rest/api/2/issue
  data: {"fields":{"description":"","issuetype":{"id":"10001"},"project":{"id":"10000"},"summary":"Blog - Visual Studio Dev Containers"}}
  response: {"errorMessages":[],"errors":{"customfield_10105":"Epic Name is required."}}
export error at 60544c6ee6a89ec70f3c3b6b254ae8effa31413e: can't export bug: exporting jira issue: HTTP response 400, query was http://localhost:8080/rest/api/2/issue
  data: {"fields":{"description":"","issuetype":{"id":"10001"},"project":{"id":"10000"},"summary":"Blog - Visual Studio Dev Containers"}}
  response: {"errorMessages":[],"errors":{"customfield_10105":"Epic Name is required."}}
exported 0 issues with localjira bridge

I tried task management

/content/images/2022/12/gitbug-36.png

That failed too due to the issueType policy

builder@DESKTOP-72D2D9T:~/Workspaces/jekyll-blog$ git bug bridge push localjira2
export error at a90ce4694faa52954847ade343d783c535e6f717: exporting jira issue: HTTP response 400, query was http://localhost:8080/rest/api/2/issue
  data: {"fields":{"description":"Use Lumi to build REST API for Function","issuetype":{"id":"10001"},"project":{"id":"10001"},"summary":"Blog - Py Func with REST API"}}
  response: {"errorMessages":[],"errors":{"issuetype":"The issue type selected is invalid."}}
export error at a90ce4694faa52954847ade343d783c535e6f717: can't export bug: exporting jira issue: HTTP response 400, query was http://localhost:8080/rest/api/2/issue
  data: {"fields":{"description":"Use Lumi to build REST API for Function","issuetype":{"id":"10001"},"project":{"id":"10001"},"summary":"Blog - Py Func with REST API"}}
  response: {"errorMessages":[],"errors":{"issuetype":"The issue type selected is invalid."}}
exported 0 issues with localjira2 bridge

Kanban and Basic failed same as SCRUM

builder@DESKTOP-72D2D9T:~/Workspaces/jekyll-blog$ git bug bridge push localjira3
export error at a90ce4694faa52954847ade343d783c535e6f717: exporting jira issue: HTTP response 400, query was http://localhost:8080/rest/api/2/issue
  data: {"fields":{"description":"Use Lumi to build REST API for Function","issuetype":{"id":"10001"},"project":{"id":"10002"},"summary":"Blog - Py Func with REST API"}}
  response: {"errorMessages":[],"errors":{"customfield_10105":"Epic Name is required."}}
export error at a90ce4694faa52954847ade343d783c535e6f717: can't export bug: exporting jira issue: HTTP response 400, query was http://localhost:8080/rest/api/2/issue
  data: {"fields":{"description":"Use Lumi to build REST API for Function","issuetype":{"id":"10001"},"project":{"id":"10002"},"summary":"Blog - Py Func with REST API"}}
  response: {"errorMessages":[],"errors":{"customfield_10105":"Epic Name is required."}}
exported 0 issues with localjira3 bridge


builder@DESKTOP-72D2D9T:~/Workspaces/jekyll-blog$ git bug bridge push localjira4
export error at a90ce4694faa52954847ade343d783c535e6f717: exporting jira issue: HTTP response 400, query was http://localhost:8080/rest/api/2/issue
  data: {"fields":{"description":"Use Lumi to build REST API for Function","issuetype":{"id":"10001"},"project":{"id":"10003"},"summary":"Blog - Py Func with REST API"}}
  response: {"errorMessages":[],"errors":{"customfield_10105":"Epic Name is required."}}
export error at a90ce4694faa52954847ade343d783c535e6f717: can't export bug: exporting jira issue: HTTP response 400, query was http://localhost:8080/rest/api/2/issue
  data: {"fields":{"description":"Use Lumi to build REST API for Function","issuetype":{"id":"10001"},"project":{"id":"10003"},"summary":"Blog - Py Func with REST API"}}
  response: {"errorMessages":[],"errors":{"customfield_10105":"Epic Name is required."}}
exported 0 issues with localjira4 bridge

I see evidence this has affected others, such as those using sentry

If I could sort out that darn customfield_10105 issue (Epic Name is locked in the settings), then I might get further. I will be circling back on this in the future

Launchpad

Here I’ll attempt to use Launchpad, the bug tracker from Canonical (Ubuntu). Frankly, it did not work, but you can see the flow below

Let’s login with our UbuntuOne account to Launchpad

We can then register the project

/content/images/2022/12/gitbug-24.png

Fill out the details

/content/images/2022/12/gitbug-25.png

then after verifying it’s not a duplicate, we can set a description and license

/content/images/2022/12/gitbug-26.png

When complete, we have a project

/content/images/2022/12/gitbug-27.png

We can try to use it

builder@DESKTOP-QADGF36:~/Workspaces/jekyll-blog$ git bug bridge configure
[1]: github
[2]: gitlab
[3]: jira
[4]: launchpad-preview
target: 4
name [default]: lpdefault
Launchpad project name: freshbrewed
Successfully configured bridge: lpdefault

But then it doesnt allow export

builder@DESKTOP-QADGF36:~/Workspaces/jekyll-blog$ git bug bridge push
Error: export is not supported
builder@DESKTOP-QADGF36:~/Workspaces/jekyll-blog$ git bug bridge push lpdefault
Error: export is not supported

That said, we can create some bugs in Launchpad.

First, we configure bugs

/content/images/2022/12/gitbug-28.png

We can then test reporting a bug

/content/images/2022/12/gitbug-29.png

Click “Report Bug” and enter a summary

/content/images/2022/12/gitbug-30.png

Then fill out some details

/content/images/2022/12/gitbug-31.png

Then we can see it in the list

/content/images/2022/12/gitbug-32.png

I tried a pull, but gave up after 20m

builder@DESKTOP-QADGF36:~/Workspaces/jekyll-blog$ git bug bridge pull lpdefault




^C
Received interrupt signal, stopping the import...
(Hit ctrl-c again to kill the process.)
^C
^C

In case it was just a 0.7.2 issue since resolved, I tried 0.8.0 as well

builder@DESKTOP-QADGF36:~/Workspaces/test-080$ git-bug version
git-bug version: v0.8.0
builder@DESKTOP-QADGF36:~/Workspaces/test-080$ git bug bridge configure
Error: .git not found
builder@DESKTOP-QADGF36:~/Workspaces/test-080$ git init
Initialized empty Git repository in /home/builder/Workspaces/test-080/.git/
builder@DESKTOP-QADGF36:~/Workspaces/test-080$ git bug bridge configure
Building identity cache... Done.
Building bug cache... Done.
[1]: github
[2]: gitlab
[3]: jira
[4]: launchpad-preview
target: 4
name [default]: launchpad
Launchpad project name: freshbrewed
Successfully configured bridge: launchpad
builder@DESKTOP-QADGF36:~/Workspaces/test-080$ git bug bridge pull launchpad

That hung. I tried using command line parameters instead of interactive

builder@DESKTOP-QADGF36:~/Workspaces/test-080$ git bug bridge configure --name=default --target=launchpad-preview --url=https:/
/bugs.launchpad.net/freshbrewed/
Building identity cache... Done.
Building bug cache... Done.
Successfully configured bridge: default
builder@DESKTOP-QADGF36:~/Workspaces/test-080$ git bug bridge pull

That also hung. While the docs errantly say the command is new (instead of configure), I’ll try even using his documented launchpad, the standard ubuntu bugs url

Trying Launchpad again

git bug bridge new \
    --name=default \
    --target=launchpad-preview \
    --url=https://bugs.launchpad.net/ubuntu/

And a test shows it hangs too

builder@DESKTOP-QADGF36:~/Workspaces$ mkdir test-080b
builder@DESKTOP-QADGF36:~/Workspaces$ cd test-080b
builder@DESKTOP-QADGF36:~/Workspaces/test-080b$ git init
Initialized empty Git repository in /home/builder/Workspaces/test-080b/.git/
builder@DESKTOP-QADGF36:~/Workspaces/test-080b$ git bug bridge new \
>     --name=default \
>     --target=launchpad-preview \
>     --url=https://bugs.launchpad.net/ubuntu/
Error: unknown flag: --name

builder@DESKTOP-QADGF36:~/Workspaces/test-080b$ git bug bridge configure --name=default --target=launchpad-preview --url
=https://bugs.launchpad.net/ubuntu/
Building identity cache... Done.
Building bug cache... Done.
Successfully configured bridge: default

builder@DESKTOP-QADGF36:~/Workspaces/test-080b$ git bug bridge pull

JIRA - Using Hosted JIRA

(This failed as well, but you can see the flow)

I’ll create an API token by going to security

/content/images/2022/12/gitbug-24b.png

Then click Create API token

/content/images/2022/12/gitbug-25b.png

Then give it a name

/content/images/2022/12/gitbug-26b.png

I did try to use Hosted JIRA to no avail

builder@DESKTOP-72D2D9T:~/Workspaces/jekyll-blog$ git bug bridge configure --name=myjira --target=jira --token=asdfasdfasfasdfasdfasdf --project=TPK --url=https://freshbrewed.atlassian.net
warning: --url is ineffective for a jira bridge
warning: tokens are ineffective for a jira bridge
JIRA server URL: https://freshbrewed.atlassian.net

JIRA has recently altered it's authentication strategies. Servers deployed
prior to October 1st 2019 must use "SESSION" authentication, whereby the REST
client logs in with an actual username and password, is assigned a session, and
passes the session cookie with each request. JIRA Cloud and servers deployed
after October 1st 2019 must use "TOKEN" authentication. You must create a user
API token and the client will provide this along with your username with each
request.
[1]: SESSION
[2]: TOKEN
Authentication mechanism: 1

JIRA login: isaac@freshbrewed.science

[1]: enter my password
[2]: ask my password each time

Select option: 1

Password:
Attempting to login with credentials...
Error: error creating token 401: {"errorMessages":["Login failed"],"errors":{}}

and interactive

builder@DESKTOP-72D2D9T:~/Workspaces/jekyll-blog$ git bug bridge configure
[1]: github
[2]: gitlab
[3]: jira
[4]: launchpad-preview
target: 3
name [default]: jira
JIRA server URL: https://freshbrewed.atlassian.net/
JIRA project key: TPK

JIRA has recently altered it's authentication strategies. Servers deployed
prior to October 1st 2019 must use "SESSION" authentication, whereby the REST
client logs in with an actual username and password, is assigned a session, and
passes the session cookie with each request. JIRA Cloud and servers deployed
after October 1st 2019 must use "TOKEN" authentication. You must create a user
API token and the client will provide this along with your username with each
request.
[1]: SESSION
[2]: TOKEN
Authentication mechanism: 2

JIRA login: isaac@freshbrewed.science

[1]: enter my password
[2]: ask my password each time

Select option: 1

Password:
Attempting to login with credentials...
Checking project ...
Error: Project TPK doesn't exist on https://freshbrewed.atlassian.net/, or authentication credentials for (isaac@freshbrewed.science) are invalid

Gitlab

I’ll create a new PAT

/content/images/2022/12/gitbug-37.png

Then use it to create a Gitlab bridge

$ git bug bridge configure --name=mygitlab --target=gitlab --token=glpat-****************** --project=dockerWithTests2
A lock file is present but the corresponding process is not, removing it.
warning: --project is ineffective for a gitlab bridge
Gitlab server URL [https://gitlab.com/]:
Gitlab project URL: https://gitlab.com/isaac.johnson/dockerWithTests2
Current identity e4543e7 tagged with login isaac.johnson
Successfully configured bridge: mygitlab

I can now pull in issues:

$ git bug bridge
lpdefault
mygitlab

$ git bug bridge pull mygitlab
new identity: e237d5b86596987d9b85f3058be4f691aa5aba71
new issue: b26ebc88397f4501b49541aafa3af929a2fdb887
new identity: dbdfa3f8c1914cb8660a4a7c5b90b23f68be23de
new issue: 011f226da72d324e1fe03e3ada0caf86d40bba70
imported 2 issues and 2 identities with mygitlab bridge

And see them reflected in git-bug

/content/images/2022/12/gitbug-38.png

I can then sync up with Github

builder@DESKTOP-QADGF36:~/Workspaces/jekyll-blog$ git bug bridge pull myghbridge
new issue: af590415820d8dbe45df83554f9dba3a1fd866c8
changed status: 86d4ff52d54b2253daf078da3c93fb940fcd7242100ebfe89c96c55f5d738009
new issue: 2e0ebbbc3dffe508e58737d6579e8e76ee9fbe94
changed label: d24dd0a881f0a09c9f8744aa397b1278805ac5f63e3aa0ff2401af03dcede16a
new issue: c73a6087730cd6d2d1099666b310681320573ad4
changed label: 63f9a4d6c046cf7997696a181dfec4844004ab38aee6ab1a7f7d67cb0ae2c669
new comment: 5423189be64516e9f2ec7e27132a25c278ccbd4417203051da036b09d8a13d17
new issue: 76384214df0dbbe1539465d387e16e19dc9a18ca
changed status: 8332753d67248d4279bb5da1460d5a1c8025a6f9202411993d04e1cdda5dcfa4
new issue: 1ead9523e8c47fcac36d60fb092c238ff2f2fd20
new issue: c428d00c510cc4251bc6351956b87e4883f52f69
new issue: 91ca3b559210e44aa9690f74057654e21d102c64
updated comment: a11850b40f084af3ccf65d02b19431c262128fdf9dfdbafc5a7b64e8c52543ba
new issue: 96214b73956f96eee62166b21cda0a8ce8583d72
new issue: 249e91a17eac97a5af46bb66f05a92f304fabecc
new identity: 5a11f2df5479d08aeb86e65b0f9a06f37231b503
new issue: cc659e3897007627ef540aa940d551183af1f676
new issue: e720c67352275678ee5a740701629f22f3679385
new issue: 9886fb136b96065716a90742044b77e01277c0fb
imported 12 issues and 1 identities with myghbridge bridge

And conversely, sync all the issues back to both Github…

builder@DESKTOP-QADGF36:~/Workspaces/jekyll-blog$ git bug bridge push myghbridge
new issue: 6b9f0e9a1334c7291e6fc87bffd245189b30d3a1
updated comment: 74486ce4a77bdec337614890df2d30682a87b2ab2dda301338f3eaa4800868ed
new issue: 60544c6ee6a89ec70f3c3b6b254ae8effa31413e
updated comment: b0c216dbc291b580f25f54cea3c4774eaa752eebc07b553c25ac7df3c7d9a437
new issue: a90ce4694faa52954847ade343d783c535e6f717
updated comment: b7489ee943f20a905648065fcc7be5ffde5119e04ad45eb1fbe7fec1f1098c15
exported 3 issues with myghbridge bridge

However, here is where we find another issue. I cannot pull from Gitlab again

builder@DESKTOP-QADGF36:~/Workspaces/jekyll-blog$ git bug bridge pull mygitlab
A lock file is present but the corresponding process is not, removing it.
panic: runtime error: index out of range [-1]

goroutine 13 [running]:
github.com/MichaelMure/git-bug/bridge/gitlab/iterator.(*issueIterator).Value(...)
        /home/michael/dev/git-bug/bridge/gitlab/iterator/issue.go:38
github.com/MichaelMure/git-bug/bridge/gitlab/iterator.(*Iterator).NextIssue(0xc000034080, 0xc0002d75e0)
        /home/michael/dev/git-bug/bridge/gitlab/iterator/iterator.go:86 +0x24c
github.com/MichaelMure/git-bug/bridge/gitlab.(*gitlabImporter).ImportAll.func1(0xc000191600, 0xc0000b4d80, 0xc0001ae180)        /home/michael/dev/git-bug/bridge/gitlab/import.go:70 +0x54f
created by github.com/MichaelMure/git-bug/bridge/gitlab.(*gitlabImporter).ImportAll
        /home/michael/dev/git-bug/bridge/gitlab/import.go:66 +0x146

And it won’t push back

builder@DESKTOP-QADGF36:~/Workspaces/jekyll-blog$ git bug bridge push mygitlab
exported 0 issues with mygitlab bridge

I tried creating a new bridge

builder@DESKTOP-QADGF36:~/Workspaces/jekyll-blog$ git bug bridge configure --name=mygitlab2 --target=gitlab --token=glpat-**************************** --project=dockerWithTests2
warning: --project is ineffective for a gitlab bridge
Gitlab server URL [https://gitlab.com/]:
Gitlab project URL: https://gitlab.com/isaac.johnson/dockerWithTests2
Error: Multiple matching identity found:
e237d5b86596987d9b85f3058be4f691aa5aba71
e4543e7950cac0cb4f77cc234ab28404f980e6fd

Even going as far as creating a new project

builder@DESKTOP-QADGF36:~/Workspaces/jekyll-blog$ git bug bridge configure --name=mygitlab3 --target=gitlab --token=glpat-**********************
Gitlab server URL [https://gitlab.com/]:
Gitlab project URL: https://gitlab.com/princessking/gitbugtest
Error: Multiple matching identity found:
e237d5b86596987d9b85f3058be4f691aa5aba71
e4543e7950cac0cb4f77cc234ab28404f980e6fd

I know the identity should be the second (e454…)

builder@DESKTOP-QADGF36:~/Workspaces/jekyll-blog$ git bug user
Id: e4543e7950cac0cb4f77cc234ab28404f980e6fd
Name: Isaac Johnson
Email: isaac.johnson@gmail.com
Login:
Last modification: Wed Dec 14 06:35:40 2022 +1400 (lamport 9)
Metadata:
    gitlab-login --> isaac.johnson
    github-login --> idjohnson

Also, interactive creation failed in the same way

builder@DESKTOP-QADGF36:~/Workspaces/jekyll-blog$ git bug bridge configure
[1]: github
[2]: gitlab
[3]: jira
[4]: launchpad-preview
target: 2
name [default]: mygitlab4
Gitlab server URL [https://gitlab.com/]:
Gitlab project URL: https://gitlab.com/princessking/gitbugtest
Gitlab login: isaac.johnson

[1]: enter my token

Existing token for gitlab:
[2]: 27632bb => (base-url:https://gitlab.com/,login:isaac.johnson) (14 Dec 22 06:42 CST)
[3]: 41caf4d => (base-url:https://gitlab.com/,login:isaac.johnson) (14 Dec 22 06:44 CST)
[4]: 7adaf73 => (base-url:https://gitlab.com/,login:isaac.johnson) (14 Dec 22 06:41 CST)
[5]: 9b05d48 => (base-url:https://gitlab.com/,login:isaac.johnson) (14 Dec 22 06:30 CST)

Select option: 2

Error: Multiple matching identity found:
e237d5b86596987d9b85f3058be4f691aa5aba71
e4543e7950cac0cb4f77cc234ab28404f980e6fd

As I researched, I found this is a known issue that was discussed at length, then closed because “a lot have changed in the bridges”. And since the latest 0.8.0 doesn’t work for me, I cannot really test in my primary repo. However, I can try in a scratch repo.

Testing bridging with GL and GH in 0.8.0

I moved to the 0.8.0 and recreated the general flow:

builder@DESKTOP-QADGF36:~/Workspaces/gbtest3$ sudo ln -s /usr/local/bin/080.git-bug.080 /usr/local/bin/git-bug
builder@DESKTOP-QADGF36:~/Workspaces/gbtest3$ git bug bridge configure --name=mygitlab6 --target=gitlab --token=glpat-******************** --project=https://gitlab.com/princessking/gitbugtest
Building identity cache... Done.
Building bug cache... Done.
warning: --project is ineffective for a gitlab bridge
Gitlab server URL [https://gitlab.com/]:
Gitlab project URL: https://gitlab.com/princessking/gitbugtest
Identity 43f447d created, set as current
Successfully configured bridge: mygitlab6
builder@DESKTOP-QADGF36:~/Workspaces/gbtest3$ history | grep git | grep bridge | grep hub
 1995  git bug bridge configure --name=myghbridge --target=github --token=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 --url=https://github.com/idjohnson/jekyll-blog
 2038  history | grep git | grep bridge | grep hub
builder@DESKTOP-QADGF36:~/Workspaces/gbtest3$ git bug bridge configure --name=myghbridge --target=github --token=********************** --url=https://github.com/idjohnson/jekyll-blog
Current identity 43f447d tagged with login idjohnson
Successfully configured bridge: myghbridge

I could pull in from both

builder@DESKTOP-QADGF36:~/Workspaces/gbtest3$ git bug bridge pull mygitlab6
imported 0 issues and 0 identities with mygitlab6 bridge
builder@DESKTOP-QADGF36:~/Workspaces/gbtest3$ git bug bridge pull myghbridge
[9fc857e] new issue: 9fc857ea8f268c1c543acb4b378eaac15003b713737fe5de6dea4e94b26d1bc7
[9fc857e] changed status with op: af6c6d6ba8fe07da960f71166d1d75a1f0abdc08f97ee113f5262e2f98a17d54
[66d647c] new issue: 66d647cfd2b91850d1f4fa04c3c0aaca7ae8e8800c38fc087ba8d77147257c13
[66d647c] changed label with op: 66a650483524a34d9a3a9cc52882e3650ca8a70f6c993f57c7002fbe6c9b4dc6
[287118f] new issue: 287118f4c9f27a42b011e701eb33e0a4fcde5ee10256e2d55895280451d686fb
[287118f] changed label with op: e46abcc6ca472b489699705337865f19795127f348c2ba0e268b58cc0d4353ca
[287118f] new comment: 2b8075118ef4c92f27ad42b0b11e7b01eba33e0da4fcede5e1e102a56e26d558
[5c8bb7c] new issue: 5c8bb7c67cd66073a177ced02c339203bb78ba29c85ba8b972560505fe406bea
[5c8bb7c] changed status with op: b18a6e269092696a52bc4f4e88ed3c35c7e9308f2fcd850c13b37923a9c1d476
[53d6fbc] new issue: 53d6fbccfebf4481149931e8b83fb466e5f177b2ff3cd6c77b986d0586a06cc6
[a5dfc2d] new issue: a5dfc2dd9aac50cb30f723b9feee7d54effc6e08a44b90b6d6123357b3c0fdd3
[8557acf] new issue: 8557acf461592a6faa384e3a8bff0a62430bd76119f1b7560a2f65fe25fd9bb6
[8557acf] updated comment: 8855557ac7f461a592ac6faaf384e43a8b6ff0a1624350bd7961192f1b7a560a
[56f1a13] new issue: 56f1a1302e72fadad94ff32c512ece678bded76f898edc7574b6e351f085bbfc
[63814cc] new issue: 63814cc228dd6dc6a50b9743378061f9ab86d074bd217074416b2f7f40b47f84
[cf27e2d] new identity: cf27e2dfe39ef1b21defff921cf7f6a33cd695a3f9488a94d27baef3974f79f1
[e1f3411] new issue: e1f34116687768bbcd916d623907bed9801ee859465eb4a874a92cba99114f37
[015e30c] new issue: 015e30c38855a16f0b08ae12fc2d366c47bc784a9aae4cdebd4c64ab6e84ac40
[494a39e] new issue: 494a39e9bef3830873c2973d8ca94221eb26be7af15cd3f62aeacd0cc699e111
[9319c30] new issue: 9319c30491c426c28da1427a6293f130fcfe4b8bbcf9074e9817bf0320ac7b71
[8a3e794] new issue: 8a3e794d51f4faf3163fcbb698f29523d1fb01d8ae7ce7417d4ce23e7c64f79c
[080f24d] new issue: 080f24d5ca4544eb2de299820a6533ff1284d13a591f416726463a14dc343478
[080f24d] updated comment: 008800f24fd5ca245444eb2dde2995820ac6533aff12484d153a5941f4146726
imported 15 issues and 1 identities with myghbridge bridge

but they didn’t push any back

builder@DESKTOP-QADGF36:~/Workspaces/gbtest3$ git bug bridge pull mygitlab6
imported 0 issues and 0 identities with mygitlab6 bridge
builder@DESKTOP-QADGF36:~/Workspaces/gbtest3$ git bug bridge push mygitlab6
exported 0 issues with mygitlab6 bridge

I created a quick issue in Gitlab

/content/images/2022/12/gitbug-39.png

I then could pull it in, but not push it back to github

builder@DESKTOP-QADGF36:~/Workspaces/gbtest3$ git bug bridge pull mygitlab6
[70b6ab2] new identity: 70b6ab2c8c941b876b27f7d46af4cd7e9553e49c6fc6105800a0408c0bb9296e
[fadc9fb] new issue: fadc9fbd44c43ce7239d9edbf7dff483dd1970e84a063149090414617a799e84
imported 1 issues and 1 identities with mygitlab6 bridge
builder@DESKTOP-QADGF36:~/Workspaces/gbtest3$ git bug bridge push mygitlab6
exported 0 issues with mygitlab6 bridge
builder@DESKTOP-QADGF36:~/Workspaces/gbtest3$ git bug bridge push myghbridge
exported 0 issues with myghbridge bridge

I fired up the webui

builder@DESKTOP-QADGF36:~/Workspaces/gbtest3$ git bug webui --port 4000 --no-open
Web UI: http://127.0.0.1:4000
Graphql API: http://127.0.0.1:4000/graphql
Graphql Playground: http://127.0.0.1:4000/playground
Press Ctrl+c to quit

And I do see the mix of issues

/content/images/2022/12/gitbug-40.png

I updated locally

/content/images/2022/12/gitbug-41.png

But even after changing, the sync was clearly one direction with Gitlab. The issue never was pushed back

builder@DESKTOP-QADGF36:~/Workspaces/gbtest3$ git bug bridge push myghbridge
exported 0 issues with myghbridge bridge
builder@DESKTOP-QADGF36:~/Workspaces/gbtest3$ git bug bridge push mygitlab6
exported 0 issues with mygitlab6 bridge
builder@DESKTOP-QADGF36:~/Workspaces/gbtest3$ git bug termui
builder@DESKTOP-QADGF36:~/Workspaces/gbtest3$ git bug bridge push mygitlab6
exported 0 issues with mygitlab6 bridge
builder@DESKTOP-QADGF36:~/Workspaces/gbtest3$ git bug bridge pull mygitlab6
imported 0 issues and 0 identities with mygitlab6 bridge
builder@DESKTOP-QADGF36:~/Workspaces/gbtest3$ git bug bridge push mygitlab6
exported 0 issues with mygitlab6 bridge

I can say that I tested Github and changes were pushed back

builder@DESKTOP-QADGF36:~/Workspaces/gbtest3$ git bug bridge push myghbridge
[494a39e] updated comment
exported 0 issues with myghbridge bridge
builder@DESKTOP-QADGF36:~/Workspaces/gbtest3$ git bug bridge push mygitlab6
exported 0 issues with mygitlab6 bridge

Syncing (Github)

One of the new patterns I’ve worked in is to regularly sync bugs I’ve created in Github into git-bug. I find this solves my need for on-the-fly bug creation when mobile (as I can use Github on my mobile).

builder@DESKTOP-72D2D9T:~/Workspaces/jekyll-blog$ git bug bridge pull
new issue: 70e1070bd8e45b83a5dad1f0537dccef6f4adf4f
updated comment: a11850b40f084af3ccf65d02b19431c262128fdf9dfdbafc5a7b64e8c52543ba
new issue: 05bf92eaf38ee04a1f3b64bbbab08515fcede10c
new issue: 9f1f8c6cd4a50e094ce8e980f238538006f4fec2
new identity: bb1c35045a8c2c55bdf8cfc5346e806307499ac5
new issue: 5b236e511f34ed5843223a03a7799ddac1d4f2bd
new issue: 607ab24996f45bfa1d867e2aeb8f7baeb738fd0f
new issue: 3c3d64b78f6a6e89f8d28ce542801288dd1d1832
imported 6 issues and 1 identities with myghbridge bridge
builder@DESKTOP-72D2D9T:~/Workspaces/jekyll-blog$ git bug push
To https://github.com/idjohnson/jekyll-blog.git
   e4543e7..192e857  refs/identities/e4543e7950cac0cb4f77cc234ab28404f980e6fd -> refs/identities/e4543e7950cac0cb4f77cc234ab28404f980e6fd
 * [new branch]      refs/identities/bb1c35045a8c2c55bdf8cfc5346e806307499ac5 -> refs/identities/bb1c35045a8c2c55bdf8cfc5346e806307499ac5To https://github.com/idjohnson/jekyll-blog.git
   b541e5b..9452db0  refs/bugs/60544c6ee6a89ec70f3c3b6b254ae8effa31413e -> refs/bugs/60544c6ee6a89ec70f3c3b6b254ae8effa31413e
   c22d352..1fbf5bc  refs/bugs/6b9f0e9a1334c7291e6fc87bffd245189b30d3a1 -> refs/bugs/6b9f0e9a1334c7291e6fc87bffd245189b30d3a1
   709ce6e..ad3d731  refs/bugs/a90ce4694faa52954847ade343d783c535e6f717 -> refs/bugs/a90ce4694faa52954847ade343d783c535e6f717
 * [new branch]      refs/bugs/05bf92eaf38ee04a1f3b64bbbab08515fcede10c -> refs/bugs/05bf92eaf38ee04a1f3b64bbbab08515fcede10c
 * [new branch]      refs/bugs/1b6b93eed06e07155f08975e7f35c32dc853d75e -> refs/bugs/1b6b93eed06e07155f08975e7f35c32dc853d75e
 * [new branch]      refs/bugs/3c3d64b78f6a6e89f8d28ce542801288dd1d1832 -> refs/bugs/3c3d64b78f6a6e89f8d28ce542801288dd1d1832
 * [new branch]      refs/bugs/44ba9a12a91bee59281597f6fdd48463b27d9e90 -> refs/bugs/44ba9a12a91bee59281597f6fdd48463b27d9e90
 * [new branch]      refs/bugs/5b236e511f34ed5843223a03a7799ddac1d4f2bd -> refs/bugs/5b236e511f34ed5843223a03a7799ddac1d4f2bd
 * [new branch]      refs/bugs/607ab24996f45bfa1d867e2aeb8f7baeb738fd0f -> refs/bugs/607ab24996f45bfa1d867e2aeb8f7baeb738fd0f
 * [new branch]      refs/bugs/6bc048ea4fb968293b2d751dc9a29c575bbf04c4 -> refs/bugs/6bc048ea4fb968293b2d751dc9a29c575bbf04c4
 * [new branch]      refs/bugs/70e1070bd8e45b83a5dad1f0537dccef6f4adf4f -> refs/bugs/70e1070bd8e45b83a5dad1f0537dccef6f4adf4f
 * [new branch]      refs/bugs/9f1f8c6cd4a50e094ce8e980f238538006f4fec2 -> refs/bugs/9f1f8c6cd4a50e094ce8e980f238538006f4fec2
 * [new branch]      refs/bugs/a6a20546e817c8c0a5ace851c7960c215a6e360b -> refs/bugs/a6a20546e817c8c0a5ace851c7960c215a6e360b
 * [new branch]      refs/bugs/d5a8c33f6f4758b0acb56ab1eb91ae59a1faf4b7 -> refs/bugs/d5a8c33f6f4758b0acb56ab1eb91ae59a1faf4b7
 * [new branch]      refs/bugs/ec1304505c4f18bf603eee2c2d7bcba3653fcb5a -> refs/bugs/ec1304505c4f18bf603eee2c2d7bcba3653fcb5a

Summary

We covered some ground. We really hammered at what doesn’t work, at least for me, with bridging - namely JIRA and Launchpad. I found Github worked the best and Gitlab worked in one direction. My attempts to containerize the webui didn’t quite pan out. Clearly, we should the possibility is there.

I feel there are enough minor bugs to wait a while and come back on the first patches after 0.8.0. It is still an active Open-Source project and I should hope for some fixes (perhaps I’ll take a swing at suggesting some patches).

gitbug

Have something to add? Feedback? Try our new forums

Isaac Johnson

Isaac Johnson

Cloud Solutions Architect

Isaac is a CSA and DevOps engineer who focuses on cloud migrations and devops processes. He also is a dad to three wonderful daughters (hence the references to Princess King sprinkled throughout the blog).

Theme built by C.S. Rhymes