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

Fix cy.addLocalContainer on github actions #1142

Merged
merged 2 commits into from
Nov 3, 2021
Merged

Conversation

himdel
Copy link
Collaborator

@himdel himdel commented Oct 27, 2021

Follow-up to #1116, which adds the helper

Successful run using the container: https://github.com/ansible/ansible-hub-ui/runs/4053371839?check_suite_focus=true (had an extra commit with a version of the test being added in #1141)

Without this, the command fails on podman push for 2 reasons:

  • needs podman login first
  • pushing to localhost:5001 works in dev, but not with pulp-oci-images, and vice versa
    • => switching to configurable localhost:8002 on pulp-oci-images while keeping localhost:5001 in cypress.env.json.template

This also switches from running one shell to run 3 commands, to running 4 commands separately in a row, to better catch error codes and stdout/stderr of each command. This should mean better error messages if something breaks again.

Should unblock: #1113, #1141


❕ Note: when testing locally, most likely you first need to add "containers": "localhost:5001" to your test/cypress.env.json (see test/cypress.env.json.template) (documented in #1082, to prevent conflicts)

@himdel himdel marked this pull request as draft October 27, 2021 19:26
@himdel himdel added the backport-4.4 This PR should be backported to stable-4.4 (2.1) label Oct 29, 2021
@himdel himdel force-pushed the pr1141 branch 2 times, most recently from c437ea7 to db4a5b4 Compare October 30, 2021 03:47
@himdel himdel changed the title [debug] addLocalContainer on github actions Fix cy.addLocalContainer on github actions Oct 30, 2021
@himdel himdel marked this pull request as ready for review October 30, 2021 03:54
…lhost:8002 when pushing containers

pulp-oci-images fails when using 5001,
local dev fails when using 8002,
making configurable
himdel added a commit to himdel/ansible-hub-ui that referenced this pull request Oct 30, 2021
himdel added a commit that referenced this pull request Nov 1, 2021
* view-only: simple test for view-only mode

* view-only: add tests

* view-only: galaxykit collection upload, to ensure there's a collection

both describes need it

* test/README: mention cypress.env.json.template, document `settings` and `restart`

* view-only: actually go to namespace detail

and wait for namespace detail title

* github cypress settings.py: turn off collections approval (GALAXY_REQUIRE_CONTENT_APPROVAL)

GALAXY_REQUIRE_CONTENT_APPROVAL=True is the default, and causes collections added by `galaxykit collection upload` to only appear in Approvals UI, where they need to be approved first before appearing

(AAH-628 is open for approval tests)

* test/README: also document `containers` in `cypress.env.json`, from #1142
patchback bot pushed a commit that referenced this pull request Nov 1, 2021
* view-only: simple test for view-only mode

* view-only: add tests

* view-only: galaxykit collection upload, to ensure there's a collection

both describes need it

* test/README: mention cypress.env.json.template, document `settings` and `restart`

* view-only: actually go to namespace detail

and wait for namespace detail title

* github cypress settings.py: turn off collections approval (GALAXY_REQUIRE_CONTENT_APPROVAL)

GALAXY_REQUIRE_CONTENT_APPROVAL=True is the default, and causes collections added by `galaxykit collection upload` to only appear in Approvals UI, where they need to be approved first before appearing

(AAH-628 is open for approval tests)

* test/README: also document `containers` in `cypress.env.json`, from #1142

(cherry picked from commit fb0a8d0)
himdel added a commit that referenced this pull request Nov 1, 2021
* view-only: simple test for view-only mode

* view-only: add tests

* view-only: galaxykit collection upload, to ensure there's a collection

both describes need it

* test/README: mention cypress.env.json.template, document `settings` and `restart`

* view-only: actually go to namespace detail

and wait for namespace detail title

* github cypress settings.py: turn off collections approval (GALAXY_REQUIRE_CONTENT_APPROVAL)

GALAXY_REQUIRE_CONTENT_APPROVAL=True is the default, and causes collections added by `galaxykit collection upload` to only appear in Approvals UI, where they need to be approved first before appearing

(AAH-628 is open for approval tests)

* test/README: also document `containers` in `cypress.env.json`, from #1142

(cherry picked from commit fb0a8d0)

Co-authored-by: Martin Hradil <mhradil@redhat.com>
@ZitaNemeckova
Copy link
Member

No luck with podman for me. BUT it works for me with docker :)

So here's my changes that worked for me

diff --git a/test/cypress/support/commands.js b/test/cypress/support/commands.js
index 81935c07..f0eed4d2 100644
--- a/test/cypress/support/commands.js
+++ b/test/cypress/support/commands.js
@@ -546,24 +546,24 @@ Cypress.Commands.add(
     const server = Cypress.env('containers');
 
     return cy
-      .exec(shell`podman pull ${registry + remoteName}`)
+      .exec(shell`docker pull ${registry + remoteName}`)
       .then(log, logFail)
       .then(() =>
         cy.exec(
-          shell`podman image tag ${remoteName} ${server}/${localName}:latest`,
+          shell`docker image tag ${remoteName} ${server}/${localName}:latest`,
         ),
       )
       .then(log, logFail)
       .then(() =>
         cy.exec(
-          shell`podman login ${server} --tls-verify=false --username=admin --password=admin`,
+          shell`docker login ${server} --tls-verify=false --username=admin --password=admin`,
           { failOnNonZeroExit: false },
         ),
       )
       .then(log, logFail)
       .then(() =>
         cy.exec(
-          shell`podman push ${server}/${localName}:latest --tls-verify=false`,
+          shell`docker push ${server}/${localName}:latest`,
           { failOnNonZeroExit: false },
         ),
       )

@ShaiahWren ShaiahWren self-requested a review November 3, 2021 13:34
Copy link
Contributor

@ShaiahWren ShaiahWren left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@ZitaNemeckova ZitaNemeckova left a comment

Choose a reason for hiding this comment

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

Let's merge it and anyone with local problems will switch to docker if needed.

@himdel himdel merged commit ad376a9 into ansible:master Nov 3, 2021
@himdel himdel deleted the pr1141 branch November 3, 2021 14:25
@patchback
Copy link

patchback bot commented Nov 3, 2021

Backport to stable-4.4: 💚 backport PR created

✅ Backport PR branch: patchback/backports/stable-4.4/ad376a9550c74369a042a3517c079766eaf9f4c6/pr-1142

Backported as #1190

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

patchback bot pushed a commit that referenced this pull request Nov 3, 2021
* addLocalContainer - call each command separately, with login & port 8002

* cypress.env.json: add .containers, use instead of localhost:5001/localhost:8002 when pushing containers

pulp-oci-images fails when using 5001,
local dev fails when using 8002,
making configurable

(cherry picked from commit ad376a9)
himdel added a commit that referenced this pull request Nov 3, 2021
* addLocalContainer - call each command separately, with login & port 8002

* cypress.env.json: add .containers, use instead of localhost:5001/localhost:8002 when pushing containers

pulp-oci-images fails when using 5001,
local dev fails when using 8002,
making configurable

(cherry picked from commit ad376a9)

Co-authored-by: Martin Hradil <mhradil@redhat.com>
@github-actions github-actions bot added the backported-4.4 This PR has been backported to stable-4.4 (2.1) label Nov 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-4.4 This PR should be backported to stable-4.4 (2.1) backported-4.4 This PR has been backported to stable-4.4 (2.1)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants