Page MenuHomeSoftware Heritage

gogs: Introduce Gogs lister
ClosedPublic

Authored by KShivendu on Jul 23 2022, 6:08 AM.

Details

Summary

Add lister for Gogs instances

Related to T1721

Diff Detail

Repository
rDLS Listers
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

Build is green

Patch application report for D8160 (id=29468)

Rebasing onto 1bf11aa26d...

Current branch diff-target is up to date.
Changes applied before test
commit c8e83162ec1640572846c65d664d2dafea85474b
Author: KShivendu <shivendu@iitbhilai.ac.in>
Date:   Sat Jul 23 09:35:33 2022 +0530

    gogs: Introduce Gogs lister

See https://jenkins.softwareheritage.org/job/DLS/job/tests-on-diff/564/ for more details.

  • gogs: Improve docstrings and comments

Build is green

Patch application report for D8160 (id=29469)

Rebasing onto 1bf11aa26d...

Current branch diff-target is up to date.
Changes applied before test
commit 0755827d3d2d41454b74da377149566b7ef0433c
Author: KShivendu <shivendu@iitbhilai.ac.in>
Date:   Sat Jul 23 10:04:56 2022 +0530

    gogs: Improve docstrings and comments

commit c8e83162ec1640572846c65d664d2dafea85474b
Author: KShivendu <shivendu@iitbhilai.ac.in>
Date:   Sat Jul 23 09:35:33 2022 +0530

    gogs: Introduce Gogs lister

See https://jenkins.softwareheritage.org/job/DLS/job/tests-on-diff/565/ for more details.

  • gogs: Add more tests to increase coverage

Build is green

Patch application report for D8160 (id=29470)

Rebasing onto 1bf11aa26d...

Current branch diff-target is up to date.
Changes applied before test
commit af49f7f36b672f59557dfda6450c274b32eba4f3
Author: KShivendu <shivendu@iitbhilai.ac.in>
Date:   Sat Jul 23 10:30:20 2022 +0530

    gogs: Add more tests to increase coverage

commit 0755827d3d2d41454b74da377149566b7ef0433c
Author: KShivendu <shivendu@iitbhilai.ac.in>
Date:   Sat Jul 23 10:04:56 2022 +0530

    gogs: Improve docstrings and comments

commit c8e83162ec1640572846c65d664d2dafea85474b
Author: KShivendu <shivendu@iitbhilai.ac.in>
Date:   Sat Jul 23 09:35:33 2022 +0530

    gogs: Introduce Gogs lister

See https://jenkins.softwareheritage.org/job/DLS/job/tests-on-diff/566/ for more details.

Hello, thx for the work. I did not check yet but can you please add the Related to TXYZ with TXYZ the related task id in the diff description?
TIA

@KShivendu A first round of review, I did not check the tests but this seems to do the job nicely according to the coverage.

Can you also please attend to the pagination link and have a look at D8160#212288 ?

Thanks in advance

swh/lister/gogs/__init__.py
1

missing copyright header, please add them.

6

we can use f-strings for that now.

swh/lister/gogs/lister.py
1
24
120

Can you please check whether the response has some pagination link inside?

It seems the documentation mentions it [1]
It'd be best to use pagination link instead of crafting the next page ourselves.
It will be more resilient over time.
And we even have some listers which lift this [2] ;).

[1] https://github.com/gogs/docs-api#link-header

[2] https://forge.softwareheritage.org/source/swh-lister/browse/master/swh/lister/gitea/lister.py$116-128

swh/lister/gogs/tasks.py
1
This revision now requires changes to proceed.Jul 26 2022, 12:49 PM

Can you also please attend to the pagination link and have a look at D8160#212288 ?

I did it since you never replied and i need to summarize stuff.
But please, do mind it for next time (that helps).

Cheers,

KShivendu marked 5 inline comments as done.
  • Use request's link header for pagination and update relevant tests
  • Fix copyright year and add missing copyright comments
  • Update comments wherever suggested

Build is green

Patch application report for D8160 (id=29500)

Rebasing onto 1bf11aa26d...

Current branch diff-target is up to date.
Changes applied before test
commit 8fabff75390e5795ebe2f8f561ce5165364741ae
Author: KShivendu <shivendu@iitbhilai.ac.in>
Date:   Mon Aug 1 19:48:11 2022 +0530

    fix: Changes suggested in review
    
    - Use request's link header for pagination and update relevant tests
    - Fix copyright year and add missing copyright comments
    - Update comments wherever suggested

commit af49f7f36b672f59557dfda6450c274b32eba4f3
Author: KShivendu <shivendu@iitbhilai.ac.in>
Date:   Sat Jul 23 10:30:20 2022 +0530

    gogs: Add more tests to increase coverage

commit 0755827d3d2d41454b74da377149566b7ef0433c
Author: KShivendu <shivendu@iitbhilai.ac.in>
Date:   Sat Jul 23 10:04:56 2022 +0530

    gogs: Improve docstrings and comments

commit c8e83162ec1640572846c65d664d2dafea85474b
Author: KShivendu <shivendu@iitbhilai.ac.in>
Date:   Sat Jul 23 09:35:33 2022 +0530

    gogs: Introduce Gogs lister

See https://jenkins.softwareheritage.org/job/DLS/job/tests-on-diff/568/ for more details.

Thanks for your feedback @ardumont

But please, do mind it for next time

For sure. Today, I've officially started my work with swh. I'll be proactive now ;)

Few things:

  • I have discovered an issue in the Gogs API. Please see T1721#88798
  • There are tons of similarities between Gitea and Gogs. Should we consider sharing code between the two?

Cheers!

Thanks for your feedback @ardumont

you're welcome.

But please, do mind it for next time

For sure. Today, I've officially started my work with swh. I'll be proactive now ;)

Great, welcome then.
And thx in advance.

Few things:

  • I have discovered an issue in the Gogs API. Please see T1721#88798

I'll check again later as i've read it but i did not completely got it.

  • There are tons of similarities between Gitea and Gogs.

Can you please describe a bit more what's common?

Should we consider sharing code between the two?

If that's not too much of a work, why not. You can try and propose something in another
diff building on this one if you really want to.

But from what i've read from the runtime code (not the tests yet), the current
implementation is landable as it is.

Cheers!

Same ;)

lgtm

Thanks!

one remark on the main class docstring that needs a tad rework to match the actual pagination implementation.

swh/lister/gogs/lister.py
37

Please reword the pagination part to match the 'Link>next' header implementation you are now using.

This revision is now accepted and ready to land.Aug 2 2022, 10:41 AM
  • update GogsLister docstring
  • squash commits

Build is green

Patch application report for D8160 (id=29513)

Rebasing onto 1bf11aa26d...

Current branch diff-target is up to date.
Changes applied before test
commit 8d72ef876d23f6929d1748675c961e6dbbd280ee
Author: KShivendu <shivendu@iitbhilai.ac.in>
Date:   Sat Jul 23 09:35:33 2022 +0530

    gogs: Introduce Gogs lister

See https://jenkins.softwareheritage.org/job/DLS/job/tests-on-diff/569/ for more details.

KShivendu marked an inline comment as done.
  • minor update to GogsLister docstring
  • squash commit (again)

Build is green

Patch application report for D8160 (id=29514)

Rebasing onto 1bf11aa26d...

Current branch diff-target is up to date.
Changes applied before test
commit d34a6232a6934c494033c1fdd71e178b838985ed
Author: KShivendu <shivendu@iitbhilai.ac.in>
Date:   Sat Jul 23 09:35:33 2022 +0530

    gogs: Introduce Gogs lister

See https://jenkins.softwareheritage.org/job/DLS/job/tests-on-diff/570/ for more details.

This revision was automatically updated to reflect the committed changes.