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

add challenge mirror, verify, format functionality #134

Merged
merged 6 commits into from
Nov 7, 2023

Conversation

MilyMilo
Copy link
Contributor

@MilyMilo MilyMilo commented Nov 3, 2023

Adds ctf challenge mirror <challenge> and ctf challenge verify <challenge> adapted from #106

Originally, this functionality was called pull and verify - however, push is already used to push challenge changes to the git repository. I think mirror is a better name, as ctfcli will attempt to mirror / copy the remote state from ctfd. This way pull stays in its current git-like form, for git-related operations.

More additions:

  • I've removed update / create / verify files - this can be achieved by just using --ignore=files.
  • I've added files_directory_name (defaulting to dist) to specify where ctfcli should download the files, relative to challenge.yml
  • I've added a warning when there are additional challenges on the remote, that are not registered locally
  • ctf challenge verify will exit with status code 2 if the verification was successful, but some challenges are out of sync.
  • I've fixed some typos

Thanks to @reteps for the initial contribution!

Closes: #101 #106

@MilyMilo
Copy link
Contributor Author

MilyMilo commented Nov 3, 2023

Also I think we'll want to add mirror after performing the deploy, so that we can get the updated connection_info, or even simply update the local challenge with connection_info, and use the new implemented challenge.save() method.

- pass files_directory_name
- fix files key not found
- fix tests on 3.8
@reteps
Copy link
Contributor

reteps commented Nov 3, 2023

Hi there,

I no longer have time to land this PR, but I have some additional changes on my fork you may want to port over after a lot of testing with my college club. Good luck landing this!

@ColdHeat
Copy link
Member

ColdHeat commented Nov 6, 2023

I like the choice of subcommands here. mirror and verify make sense.

In terms of the deploy I think if we can mirror just the connection_info it would be best.

@ColdHeat
Copy link
Member

ColdHeat commented Nov 6, 2023

@MilyMilo This seems good to go. Is this still WIP or ready to merge?

@MilyMilo
Copy link
Contributor Author

MilyMilo commented Nov 7, 2023

Yeah let's add the mirror after sync, I'll do that now.

Miłosz Skaza added 2 commits November 7, 2023 11:35
- add connection_info to the local challenge after deployment
- add format command to format challenge.yml files
- add more documentation
@MilyMilo
Copy link
Contributor Author

MilyMilo commented Nov 7, 2023

Okay so some more changes:

  • connection_info will be added to the challenge.yml after deployment
  • I've added a challenge format command to enforce the formatting used by ctfcli. It's pretty simple but running mirror will output challenge.yml files in that format, so if we want to be consistent we might as well format everything the same way.
  • I've added the new commands to the README

@MilyMilo MilyMilo changed the title WIP: add challenge mirror / verify functionality add challenge mirror / verify functionality Nov 7, 2023
@MilyMilo MilyMilo changed the title add challenge mirror / verify functionality add challenge mirror, verify, format functionality Nov 7, 2023
@ColdHeat ColdHeat merged commit 93f8cae into CTFd:master Nov 7, 2023
9 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.

ctf challenge verify
3 participants