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

Fetch docker names without github token #555

Merged
merged 13 commits into from
Dec 16, 2024
Merged

Conversation

lrlunin
Copy link
Collaborator

@lrlunin lrlunin commented Nov 21, 2024

This fix in combination with #537 allows user to send pull requests from forks and all workflows be executed. The issue before was the fact the the GH REST API request required the secret token for fetch of the docker images list.

Now this is done matching the filenames in docker directory.

Copy link
Contributor

github-actions bot commented Nov 21, 2024

📚 Documentation

📁 Download as zip
🔍 View online

@lrlunin lrlunin marked this pull request as ready for review November 21, 2024 17:28
Copy link
Contributor

github-actions bot commented Nov 21, 2024

Coverage

Coverage Report
FileStmtsMissCoverMissing
src/mrpro/algorithms/csm
   inati.py24196%44
   walsh.py16194%34
src/mrpro/algorithms/dcf
   dcf_voronoi.py53492%15, 48–49, 76
src/mrpro/algorithms/optimizers
   adam.py20195%69
src/mrpro/algorithms/reconstruction
   DirectReconstruction.py281643%51–71, 85
   IterativeSENSEReconstruction.py13192%76
   Reconstruction.py502256%42, 54–56, 80–87, 104–113
   RegularizedIterativeSENSEReconstruction.py411759%96–100, 114–139
src/mrpro/data
   AcqInfo.py128398%26, 169, 207
   CsmData.py29390%15, 82–84
   DcfData.py45882%18, 66, 78–83
   IData.py67987%119, 125, 129, 159–167
   IHeader.py75791%75, 109, 127–131
   KHeader.py1531789%25, 119–123, 150, 199, 210, 217–218, 221, 228, 260–271
   KNoise.py311552%39–52, 56–61
   KTrajectory.py69593%178–182
   MoveDataMixin.py1401887%15, 113, 129, 143–145, 207, 323–325, 338, 417, 437–438, 440, 455–456, 458
   QData.py39782%42, 65–73
   Rotation.py6743595%100, 198, 335, 433, 477, 495, 581, 583, 592, 626, 628, 691, 768, 773, 776, 791, 808, 813, 889, 1077, 1082, 1085, 1109, 1113, 1240, 1242, 1250–1251, 1315, 1397, 1690, 1846, 1881, 1885, 1996
   SpatialDimension.py2322191%34, 104, 141, 148, 154, 274–276, 289–291, 325, 343, 356, 369, 382, 395, 404–405, 420, 429
   acq_filters.py12192%47
src/mrpro/data/_kdata
   KData.py1341887%109–110, 125, 132, 142, 150, 204–205, 243, 248–249, 268–279
   KDataRemoveOsMixin.py29293%44, 46
   KDataSelectMixin.py19289%48, 63
   KDataSplitMixin.py48394%53, 84, 93
src/mrpro/data/traj_calculators
   KTrajectoryCalculator.py25292%23, 45
   KTrajectoryIsmrmrd.py13285%41, 50
   KTrajectoryPulseq.py31197%54
src/mrpro/operators
   CartesianSamplingOp.py89397%118, 157, 280
   ConstraintsOp.py60297%46, 48
   EndomorphOperator.py65297%228, 234
   FiniteDifferenceOp.py27293%40, 105
   FourierOp.py158398%263, 381, 386
   Functional.py71593%20–22, 117, 119
   GridSamplingOp.py136993%72–73, 82–83, 90–91, 94, 96, 98
   LinearOperator.py1681094%55, 91, 190, 220, 261, 270, 278, 287, 295, 320
   LinearOperatorMatrix.py1581690%82, 119, 152, 161, 166, 175–178, 191–194, 203, 215, 304, 331, 359
   MultiIdentityOp.py13285%43, 48
   Operator.py78297%25, 74
   ProximableFunctionalSeparableSum.py39392%50, 103, 110
   SliceProjectionOp.py173895%44, 61, 63, 69, 206, 227, 260, 300
   WaveletOp.py120596%152, 170, 205, 210, 233
   ZeroPadOp.py16194%30
src/mrpro/utils
   filters.py62297%44, 49
   reshape.py60198%191
   slice_profiles.py46687%20, 36, 113–116, 149
   sliding_window.py34197%34
   split_idx.py10280%43, 47
   summarize_tensorvalues.py11918%20–29
   typing.py181139%8–23
   zero_pad_or_crop.py31681%26, 30, 54, 57, 60, 63
TOTAL491235393% 

Tests Skipped Failures Errors Time
2262 0 💤 0 ❌ 0 🔥 2m 7s ⏱️

@fzimmermann89
Copy link
Member

would it be easy to make the workflow fail if no docker files were found? just as a small safety net

@lrlunin
Copy link
Collaborator Author

lrlunin commented Nov 21, 2024

would it be easy to make the workflow fail if no docker files were found? just as a small safety net

As my first commit experience tells - it will fail anyway in the next step when it will try to fetch the docker. But I'll take a look now.

@ckolbPTB
Copy link
Collaborator

Do we also have to adapt the docker-workflow?

Co-authored-by: Christoph Kolbitsch <christoph.kolbitsch@ptb.de>
@lrlunin
Copy link
Collaborator Author

lrlunin commented Nov 21, 2024

Do we also have to adapt the docker-workflow?

I do not think so. This will not be executed at pull-request. It interacts with registry and tokens only on github.event_name == 'push' i.e. push on main.

@ckolbPTB
Copy link
Collaborator

It should be triggered if anything related to the docker image (toml file or the docker file itself) changes, shouldn't it?

@fzimmermann89
Copy link
Member

pushing the test docker images cannot work from forks.
so it can realistically only be done here anyways. same with releases to testpypi.

so release and changes to docker will always be done on the main repo.

@fzimmermann89
Copy link
Member

we coulld change the docker action to also use sed (or change it here to also use jq), as on both pretty much the same step is done to obtain the imagenames, but with slightly different commands..

@lrlunin
Copy link
Collaborator Author

lrlunin commented Nov 21, 2024

we coulld change the docker action to also use sed (or change it here to also use jq), as on both pretty much the same step is done to obtain the imagenames, but with slightly different commands..

The sed here is not really replaceable here with jq or jq in later steps is replaceable with sed. For the $GITHUB_OUTPUT we need a JSON like array ["one", "two", "three"] while the first step in the pytest.yml is done purely with the bash arrays. The reason we needed the jq before was the JSON answer from the GH API request.

I would change the cd ... & ls ... with the find ... in the docker.yml and docs.yml.

.github/workflows/docker.yml Outdated Show resolved Hide resolved
@ckolbPTB
Copy link
Collaborator

so release and changes to docker will always be done on the main repo.

would be good to discuss then in a meeting how we envisage the new workflow

@ckolbPTB
Copy link
Collaborator

Quick question: If I create a fork and then a PR to main. The PR gets approved and I merge the PR into main. Currently this would trigger our docker-pipeline as "push to main". This will run on main and hence the github token should be available, shouldn't it?

@lrlunin
Copy link
Collaborator Author

lrlunin commented Nov 27, 2024

Quick question: If I create a fork and then a PR to main. The PR gets approved and I merge the PR into main. Currently this would trigger our docker-pipeline as "push to main". This will run on main and hence the github token should be available, shouldn't it?

I have expected it to do so. Only after push on branch main the push to registry will be initiated and the only this really needs to have a token for push.

I also think that right now there is a special token generated and placed in secrets due to that API request. After this pull-request It can be deleted if we use a default GITHUB_TOKEN with given "write permissions" for workflows to push.

@fzimmermann89
Copy link
Member

fzimmermann89 commented Nov 27, 2024

I am looking forward to getting this PR merged -- and then trying it out.

I don't think there is a good way to test if this really fixes all issues with forks. It looks like it should work ;)

@lrlunin
Copy link
Collaborator Author

lrlunin commented Nov 27, 2024

I am looking forward to getting this PR merged -- and then trying it out.

I don't think there is a good way to test if this really fixes all issues with forks. It looks like it should work ;)

I can do it with my "mock" repo or you can just create an own if you wish.

Or you can run the workflow locally with the act with env push main and then check this out ;-)
I'll try this today evening.

@ckolbPTB ckolbPTB mentioned this pull request Dec 10, 2024
10 tasks
@fzimmermann89 fzimmermann89 enabled auto-merge (squash) December 16, 2024 13:39
@fzimmermann89 fzimmermann89 merged commit f6f921d into main Dec 16, 2024
32 checks passed
@fzimmermann89 fzimmermann89 deleted the workflow-token-fix branch December 16, 2024 14:03
@fzimmermann89 fzimmermann89 mentioned this pull request Dec 17, 2024
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