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

DTR replication support #9512

Merged
merged 18 commits into from
Oct 29, 2020
Merged

DTR replication support #9512

merged 18 commits into from
Oct 29, 2020

Conversation

gregsidelinger
Copy link
Contributor

Support for Docker Trusted Registry, https://docs.docker.com/ee/dtr/.

I've tested this on DTR 2.7.3. Push and pull support are both working.

wy65701436 and others added 4 commits October 22, 2019 10:49
Signed-off-by: wang yan <wangyan@vmware.com>
Signed-off-by: Greg Sidelinger <gate@ilive4code.net>
- no code contained
- for 1.10

Signed-off-by: Greg Sidelinger <gate@ilive4code.net>
Signed-off-by: Greg Sidelinger <gate@ilive4code.net>
Signed-off-by: Greg Sidelinger <gate@ilive4code.net>
@xaleeks
Copy link
Contributor

xaleeks commented Nov 11, 2019

Thanks for the PR, as this is integration with a specific version of DTR hosted registry, we need to consider testing and support for future versions as well before merging. But it's great that you got this replication working.

@gregsidelinger
Copy link
Contributor Author

Im not aware of any version specific stuff I did but will do a test with a much older version of DTR we still have setup later this week. I can also stand up a 2.6.x version to test without much trouble. As for future compatibility that would need to be addressed when DTR adds a v1 api, breaks v0 or changes how UCP and DTR work together since they are tied at the hips right now which I have no insight into.

@gregsidelinger
Copy link
Contributor Author

I was able to test the patch against DTR 2.4.13 today. Both pushing and pulling replication worked without any issues. It was able to make organizations, repositories and then sync the images without any issues while pushing. The pulling worked without any issues.

@bitsf
Copy link
Contributor

bitsf commented Nov 21, 2019

@gregsidelinger need fix code format as ci failed

Signed-off-by: Greg Sidelinger <gate@ilive4code.net>
@gregsidelinger
Copy link
Contributor Author

Wow, fixing three log lines cause almost all CI tests to fail with new errors. Looking into why go vet is angry, may need to rebase as it has been a month.

@gregsidelinger
Copy link
Contributor Author

I reproduced the new CI errors locally after merging with master. I updated my code with the new factory that all replication adaptors now implement and go vet is clean. Will run a few tests tomorrow when I have access to DTR and update the PR.

@coveralls
Copy link

coveralls commented Nov 22, 2019

Pull Request Test Coverage Report for Build 2e8bd1506-PR-9512

  • 272 of 462 (58.87%) changed or added relevant lines in 3 files are covered.
  • 4 unchanged lines in 1 file lost coverage.
  • Overall coverage decreased (-0.07%) to 64.664%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/replication/adapter/dtr/adapter.go 93 188 49.47%
src/replication/adapter/dtr/client.go 162 257 63.04%
Files with Coverage Reduction New Missed Lines %
src/common/rbac/project/visitor_role.go 4 86.21%
Totals Coverage Status
Change from base Build 72f9e02dd: -0.07%
Covered Lines: 26028
Relevant Lines: 40251

💛 - Coveralls

Signed-off-by: Greg Sidelinger <gate@ilive4code.net>
@gregsidelinger
Copy link
Contributor Author

I cleaned up the formatting of the code to make all of the CI checks happy and have all the commits signed. Let me know if there is anything else.

var accounts []Account
var response Accounts

endpoint := fmt.Sprintf("%s/enzi/v0/accounts?limit=100", c.url)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you share the api document that you are referenced here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://docs.docker.com/v17.09/datacenter/dtr/2.3/reference/api/

Unfortunately this API is no longer documented in the latest API docs however it is still there. It is the only way to create orgs as the core DTR api does not support any of those features based on how tied it is to UCP.

Copy link
Contributor

@bitsf bitsf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you have an existing env that we can have a test

@gregsidelinger
Copy link
Contributor Author

Do you have an existing env that we can have a test

All of my current DTR environments are within my companies network which I can not open up. I think a limited version of UCP with DTR can be stood up without license keys. Or they do offer a 30 day trial key.

https://docs.docker.com/ee/ucp/admin/install/
https://docs.docker.com/ee/dtr/admin/install/

@steven-zou steven-zou changed the title DTR replication support [DON'T MERGE]DTR replication support May 21, 2020
Copy link
Contributor

@bitsf bitsf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pending merge as Steven required

@gregsidelinger
Copy link
Contributor Author

I have an updated PR for the changes in 2.0. I still need to do some testing however the test suite is passing. I use helm to deploy harbor so I'm not yet running 2.0 since the chart still needs updated based on the 2.0.0 release notes. Once the chart is updated I do some manual testing and commit the changes.

Let me know what needs done for the compliance verification testing framework once more of that is finalized.

Signed-off-by: Greg Sidelinger <gate@ilive4code.net>
@codecov
Copy link

codecov bot commented Jun 8, 2020

Codecov Report

Merging #9512 into master will decrease coverage by 0.04%.
The diff coverage is 58.30%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #9512      +/-   ##
==========================================
- Coverage   61.73%   61.69%   -0.05%     
==========================================
  Files         916      919       +3     
  Lines       54436    54743     +307     
  Branches     2039     2039              
==========================================
+ Hits        33605    33772     +167     
- Misses      17061    17157      +96     
- Partials     3770     3814      +44     
Flag Coverage Δ
#unittests 61.69% <58.30%> (-0.05%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/jobservice/job/impl/replication/replication.go 51.35% <ø> (ø)
src/replication/model/registry.go 25.00% <ø> (ø)
src/replication/replication.go 88.23% <ø> (ø)
src/replication/adapter/dtr/client.go 52.19% <52.19%> (ø)
src/replication/adapter/dtr/adapter.go 64.03% <64.03%> (ø)
src/replication/adapter/dtr/types.go 100.00% <100.00%> (ø)
...ig/vulnerability/vulnerability-config.component.ts 47.53% <0.00%> (-6.18%) ⬇️
src/common/utils/passports.go 84.61% <0.00%> (-5.13%) ⬇️
...rtal/src/lib/components/filter/filter.component.ts 80.76% <0.00%> (-3.85%) ⬇️
... and 3 more

@steven-zou steven-zou added candidate/2.1.0 issues with P1 priority in 2.1 release replication/adapters related to replication adapters and removed candidate/2.0 labels Jul 24, 2020
@wy65701436 wy65701436 removed the candidate/2.1.0 issues with P1 priority in 2.1 release label Aug 3, 2020
@wy65701436
Copy link
Contributor

We will consider to merge it after the testing framework is ready. @bitsf , please give update about the progress of testing framework development, and the document of how to use it.

@gregsidelinger
Copy link
Contributor Author

@bitsf any update on the testing framework?

@MnrGreg
Copy link
Contributor

MnrGreg commented Sep 18, 2020

Lots of bug fixes and new features in v2.1.0 but sad to see this one didn't make it. Community, lets up vote this for the next release!?

@bitsf @wy65701436 where can we track the Testing Framework?

@steven-zou
Copy link
Contributor

@bitsf any update on the testing framework?

@gregsidelinger

Thanks for the patience.

We have created a verification framework to test and verify if the related replication adapters are still working well with Harbor, see the repo https://github.com/goharbor/replication-verification.

Please follow the readme to see if your adapter can pass the testing and then paste the testing results here. If cases are passed, we can accept and merge this adapter that's expected for a long while.

Any help needed, please ping @bitsf / me. Thanks.

@bitsf
Copy link
Contributor

bitsf commented Oct 20, 2020

@gregsidelinger because we don't have the environment, so you just need to upload the test result to prove everything is working fine.
you can create a test case file like master/cases/Quay.robot, and prepare some images in your DTR registry, and run the test job with python -u -m robot.run ..., of course you need prepare the env reference the CI file .github/workflows/main.yml

@steven-zou steven-zou changed the title [DON'T MERGE]DTR replication support DTR replication support Oct 20, 2020
@gregsidelinger
Copy link
Contributor Author

I'm a bit confused about the Post actions as documented in CONTRIBUTING. For steps 2-4. Am I suppose to send you the PR for my test case and include login info for a DTR setup?

## 3. Post actions

1. Attach the gif record generated at the step 4 of section 2 to the adapter code PR mentioned at step 4 of section 1
as a proof of the PR.
2. Provide the AK info that we can add to the github Secrets.
3. Change .github/workflows/main.yml#112 and your case to using the AK in secrets.
4. Raise PR to submit the testing cases for the new adapter to this repository for future regular executions.

The DTR I have access to is sitting inside my companies network and is not exposed to the Internet. I can setup and run the test case once but there is no way I can expose DTR on the Internet let along provide login access to it.

Signed-off-by: Greg Sidelinger <gate@ilive4code.net>
@steven-zou
Copy link
Contributor

The DTR I have access to is sitting inside my companies network and is not exposed to the Internet. I can setup and run the test case once but there is no way I can expose DTR on the Internet let along provide login access to it.

@gregsidelinger

Got the point. You can use your DTR env to run the case offline and provide the results here. But it's internal env and then can not be used in the regular replication adapter verification pipeline.

Let's skip the post actions so far.

After PR is merged, we can continue to think about how to activate the verification test cases in the framework later.

cc @bitsf

@bitsf
Copy link
Contributor

bitsf commented Oct 26, 2020

@gregsidelinger please rebase commit and merge

@bitsf
Copy link
Contributor

bitsf commented Oct 28, 2020

@gregsidelinger hi, it always has conflicts and can't merge.
you should submit only 1 commit that would make the commit history looks better.

  1. git checkout goharbor/master
  2. git merge [commitid] --no-commit
  3. git commit
  4. git push -f gregsidelinger dtr

@bitsf bitsf merged commit d1ee94b into goharbor:master Oct 29, 2020
danfengliu pushed a commit to danfengliu/harbor that referenced this pull request Nov 3, 2020
Adding DTR replication support

Signed-off-by: Greg Sidelinger <gate@ilive4code.net>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.