ctfcli icon indicating copy to clipboard operation
ctfcli copied to clipboard

Handle challenge deletion and/or name changes

Open pl4nty opened this issue 2 years ago • 7 comments

I currently use ctfcli like an infrastructure-as-code provider in CI/CD pipelines. However, the following resource changes (challenges/containers/services) must be reconciled manually:

  • Name changes, as it's the sync anchor
  • Resource deleted from repo

Other providers like Azure offer a "complete" mode, where resources that aren't defined in the repo are deleted. This would support the change types listed above.

Not sure whether this aligns to ctfcli's design though - maybe a Terraform provider would be a better fit, since it's common for CTF infrastructure anyway.

pl4nty avatar Mar 13 '23 00:03 pl4nty

Looks like there's a Terraform version here, not sure how stable it is though: https://github.com/PsypherPunk/terraform-provider-ctfd

pl4nty avatar Mar 13 '23 00:03 pl4nty

Would be fixed by #159

reteps avatar Sep 11 '24 04:09 reteps

in my case, my CI is stateless, so #159 wouldn't work for me

pl4nty avatar Sep 11 '24 05:09 pl4nty

I don't think you could reconcile renames with a stateless system unless you diff commit history (which in itself, is state).

This issue makes ctfcli unusable for us, as we have infrastructure changes after people solve challenges. Thus, deleting a renamed challenge and recreating it deletes solves, which we cannot do.

reteps avatar Sep 11 '24 05:09 reteps

I am sortof suggesting a new paradigm:

  • You use your CI pipeline to commit the .ctf/config file to git
  • The CI is no longer stateless

reteps avatar Sep 11 '24 05:09 reteps

Would you be able to provide more details about your usecase?

reteps avatar Sep 11 '24 05:09 reteps

I suggested delete/recreate because I don't run ctfcli during competitions, to avoid any unexpected changes. but I understand that this approach might not align to ctfcli's design

I generate .ctf/config at runtime to avoid storing credentials in git, and allow challenge creation without authors needing ctfcli

pl4nty avatar Sep 11 '24 05:09 pl4nty