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

Inject context to filter signatures based on distro.repository #1465

Merged
merged 2 commits into from
Oct 11, 2022

Conversation

rochacbruno
Copy link
Member

@rochacbruno rochacbruno commented Sep 27, 2022

Issue: AAH-1941

What is this PR doing:

Filtering signatures by distro.repository coming from context["request"]

Reviewers must know:

affects:
http://0.0.0.0:5001/api/automation-hub/_ui/v1/repo/rh-certified/namespace/name/
http://0.0.0.0:5001/api/automation-hub/_ui/v1/repo/rh-certified/
http://0.0.0.0:8002/ui/repo/rh-certified
http://0.0.0.0:8002/ui/repo/rh-certified/namespace/name
http://0.0.0.0:5001/api/automation-hub/_ui/v1/collection-versions/?repository=reponame

Copy Endpoint Added

/api/automation-hub/content/<str:path>/v3/collections/<str:namespace>/<str:name>/versions/<str:version>/copy/<str:source_path>/<str:dest_path>/	galaxy_ng.app.api.v3.viewsets.collection.CollectionVersionCopyViewSet	galaxy:api:v3:collection-version-copy
/api/automation-hub/v3/collections/<str:namespace>/<str:name>/versions/<str:version>/copy/<str:source_path>/<str:dest_path>/	galaxy_ng.app.api.v3.viewsets.collection.CollectionVersionCopyViewSet	galaxy:api:v3:collection-version-copy

Notes:

PR Author: Add a QE reviewer (exceptions);
Reviewers: look for sound code, no code smells, docs & test coverage
Merger: When merging, include the Jira issue link in the squashed commit

@netlify
Copy link

netlify bot commented Sep 27, 2022

Deploy Preview for galaxyng ready!

Name Link
🔨 Latest commit 4fef418
🔍 Latest deploy log https://app.netlify.com/sites/galaxyng/deploys/6343ee7ba46146000877ee67
😎 Deploy Preview https://deploy-preview-1465--galaxyng.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@rochacbruno rochacbruno added backport-4.2 This PR should be backported to stable-4.2 (1.2) backport-4.4 This PR should be backported to stable-4.4 (2.1) backport-4.5 This PR should be backported to stable-4.5 (2.2) labels Sep 27, 2022
Copy link
Contributor

@awcrosby awcrosby left a comment

Choose a reason for hiding this comment

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

Sounds like for testing you need a CollectionVersion in multiple repos. It would be nice to copy a collection from repo1 to repo2 and then sign in only repo1, but we don't have an endpoint for copying right now.

If you call collection-version-move to move an already signed collection from repo1 to repo2, will the signature get moved with it? (if not, then you could check the content shows as signed only when in repo1)

Not sure if a unit test would be sufficient, but we have the ability to call add_and_remove like this:

@rochacbruno rochacbruno added the backport-4.6 This PR should be backported to stable-4.6 (2.3) label Oct 3, 2022
@awcrosby awcrosby removed backport-4.2 This PR should be backported to stable-4.2 (1.2) backport-4.4 This PR should be backported to stable-4.4 (2.1) labels Oct 6, 2022
@rochacbruno rochacbruno marked this pull request as draft October 7, 2022 17:31
@rochacbruno rochacbruno force-pushed the aah-1941 branch 2 times, most recently from bc6a88c to 4fef418 Compare October 10, 2022 10:05
@rochacbruno rochacbruno marked this pull request as ready for review October 10, 2022 10:25
Copy link
Contributor

@awcrosby awcrosby left a comment

Choose a reason for hiding this comment

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

Added one possible edit

galaxy_ng/app/api/v3/viewsets/collection.py Outdated Show resolved Hide resolved
@newswangerd newswangerd merged commit b1743a6 into ansible:master Oct 11, 2022
@patchback
Copy link

patchback bot commented Oct 11, 2022

Backport to stable-4.5: 💔 cherry-picking failed — conflicts found

❌ Failed to cleanly apply b1743a6 on top of patchback/backports/stable-4.5/b1743a68d560ff8d4d84c5ee34aa9fa3979a0da4/pr-1465

Backporting merged PR #1465 into master

  1. Ensure you have a local repo clone of your fork. Unless you cloned it
    from the upstream, this would be your origin remote.
  2. Make sure you have an upstream repo added as a remote too. In these
    instructions you'll refer to it by the name upstream. If you don't
    have it, here's how you can add it:
    $ git remote add upstream https://github.com/ansible/galaxy_ng.git
  3. Ensure you have the latest copy of upstream and prepare a branch
    that will hold the backported code:
    $ git fetch upstream
    $ git checkout -b patchback/backports/stable-4.5/b1743a68d560ff8d4d84c5ee34aa9fa3979a0da4/pr-1465 upstream/stable-4.5
  4. Now, cherry-pick PR Inject context to filter signatures based on distro.repository #1465 contents into that branch:
    $ git cherry-pick -x b1743a68d560ff8d4d84c5ee34aa9fa3979a0da4
    If it'll yell at you with something like fatal: Commit b1743a68d560ff8d4d84c5ee34aa9fa3979a0da4 is a merge but no -m option was given., add -m 1 as follows intead:
    $ git cherry-pick -m1 -x b1743a68d560ff8d4d84c5ee34aa9fa3979a0da4
  5. At this point, you'll probably encounter some merge conflicts. You must
    resolve them in to preserve the patch from PR Inject context to filter signatures based on distro.repository #1465 as close to the
    original as possible.
  6. Push this branch to your fork on GitHub:
    $ git push origin patchback/backports/stable-4.5/b1743a68d560ff8d4d84c5ee34aa9fa3979a0da4/pr-1465
  7. Create a PR, ensure that the CI is green. If it's not — update it so that
    the tests and any other checks pass. This is it!
    Now relax and wait for the maintainers to process your pull request
    when they have some cycles to do reviews. Don't worry — they'll tell you if
    any improvements are necessary when the time comes!

🤖 @patchback
I'm built with octomachinery and
my source is open — https://github.com/sanitizers/patchback-github-app.

@patchback
Copy link

patchback bot commented Oct 11, 2022

Backport to stable-4.6: 💔 cherry-picking failed — conflicts found

❌ Failed to cleanly apply b1743a6 on top of patchback/backports/stable-4.6/b1743a68d560ff8d4d84c5ee34aa9fa3979a0da4/pr-1465

Backporting merged PR #1465 into master

  1. Ensure you have a local repo clone of your fork. Unless you cloned it
    from the upstream, this would be your origin remote.
  2. Make sure you have an upstream repo added as a remote too. In these
    instructions you'll refer to it by the name upstream. If you don't
    have it, here's how you can add it:
    $ git remote add upstream https://github.com/ansible/galaxy_ng.git
  3. Ensure you have the latest copy of upstream and prepare a branch
    that will hold the backported code:
    $ git fetch upstream
    $ git checkout -b patchback/backports/stable-4.6/b1743a68d560ff8d4d84c5ee34aa9fa3979a0da4/pr-1465 upstream/stable-4.6
  4. Now, cherry-pick PR Inject context to filter signatures based on distro.repository #1465 contents into that branch:
    $ git cherry-pick -x b1743a68d560ff8d4d84c5ee34aa9fa3979a0da4
    If it'll yell at you with something like fatal: Commit b1743a68d560ff8d4d84c5ee34aa9fa3979a0da4 is a merge but no -m option was given., add -m 1 as follows intead:
    $ git cherry-pick -m1 -x b1743a68d560ff8d4d84c5ee34aa9fa3979a0da4
  5. At this point, you'll probably encounter some merge conflicts. You must
    resolve them in to preserve the patch from PR Inject context to filter signatures based on distro.repository #1465 as close to the
    original as possible.
  6. Push this branch to your fork on GitHub:
    $ git push origin patchback/backports/stable-4.6/b1743a68d560ff8d4d84c5ee34aa9fa3979a0da4/pr-1465
  7. Create a PR, ensure that the CI is green. If it's not — update it so that
    the tests and any other checks pass. This is it!
    Now relax and wait for the maintainers to process your pull request
    when they have some cycles to do reviews. Don't worry — they'll tell you if
    any improvements are necessary when the time comes!

🤖 @patchback
I'm built with octomachinery and
my source is open — https://github.com/sanitizers/patchback-github-app.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-4.5 This PR should be backported to stable-4.5 (2.2) backport-4.6 This PR should be backported to stable-4.6 (2.3)
Projects
None yet
3 participants