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

Allow GH actions on PRs from forked repos #2080

Merged

Conversation

martin-mat
Copy link
Collaborator

@martin-mat martin-mat commented Jun 20, 2024

Make "docker login" in spec execution optional. Note that it has anyway limited (if any) effect as docker registry mirror cache is used and docker login does not really have expected affect. The registry mirror cache itself needs to be configured with respective credentials.

Issues:

Refs: #2066

How has this been tested:

  • Covered by existing integration testing
  • Added integration testing to cover
  • Verified all A/C passes
    • develop
    • master
    • tag/other branch
  • Test environment
    • Shared Packet K8s cluster
    • New Packet K8s cluster
    • Kind cluster
  • Have not tested

Types of changes:

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update

Checklist:

Documentation

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • No updates required.

Code Review

  • Does the test handle fatal exceptions, ie. rescue block

Issue

  • Tasks in issue are checked off

@martin-mat martin-mat changed the title Allow GH actions from forked repos Allow GH actions on PRs from forked repos Jun 20, 2024
@horecoli
Copy link
Contributor

horecoli commented Jun 21, 2024

What about registry_spec.cr where docker login is mandatory? There is code like:

if ENV["DOCKERHUB_USERNAME"]? && ENV["DOCKERHUB_PASSWORD"]?
result = Dockerd.exec("docker login -u $DOCKERHUB_USERNAME -p $DOCKERHUB_PASSWORD", force_output: true)
Log.info { "Docker Login output: #{result[:output]}" }
else
puts "DOCKERHUB_USERNAME & DOCKERHUB_PASSWORD Must be set.".colorize(:red)
exit 1
end

@martin-mat
Copy link
Collaborator Author

martin-mat commented Jun 21, 2024

What about registry_spec.cr where docker login is mandatory? There is code like:

if ENV["DOCKERHUB_USERNAME"]? && ENV["DOCKERHUB_PASSWORD"]? result = Dockerd.exec("docker login -u $DOCKERHUB_USERNAME -p $DOCKERHUB_PASSWORD", force_output: true) Log.info { "Docker Login output: #{result[:output]}" } else puts "DOCKERHUB_USERNAME & DOCKERHUB_PASSWORD Must be set.".colorize(:red) exit 1 end

Good point. Currently it passes because DOCKERHUB_USERNAME are set (but empty string) so the condition is true. Docker login fails but is ignored. At the end the test passes, despite not being logged in to dockerhub.

Copy link
Contributor

@horecoli horecoli 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
Collaborator

@kosstennbl kosstennbl left a comment

Choose a reason for hiding this comment

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

lgtm, clean and simple workaround

@martin-mat martin-mat merged commit 6e1aefe into cnti-testcatalog:main Jun 25, 2024
88 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants