eth-cscs / manta

Another CLI for Alps
https://eth-cscs.github.io/manta/
BSD 3-Clause "New" or "Revised" License
14 stars 3 forks source link

FEATURE: resolve `commit id` from branch names when applying SAT files #44

Open Masber opened 6 months ago

Masber commented 6 months ago

manta currently does not resolves branch names in SAT files, it instead leverages this task to the CFS service. This has work for now but recently we found a bug in CFS where it could not resolve the branch name.

Error when creating a CFS configuration:

Error: Command '['git', 'checkout', 'cfs-layer-psi']' returned non-zero exit status 128.

This error while creating a CFS configuration means, CFS service could not validate the branch name and fails.

When using SAT file, the default behavior hides this because SAT will resolve the branch name on behalf of CFS service.

# sudo sat bootprep run --help
usage: sat bootprep run [-h] [--dry-run] [--save-files] [--no-resolve-branches] [--delete-ims-jobs] [--bos-version {v1,v2}] [--recipe-version RECIPE_VERSION] [--vars-file VARS_FILE] [--vars VARS] [--skip-existing-configs | --overwrite-configs]
                        [--skip-existing-images | --overwrite-images] [--skip-existing-templates | --overwrite-templates] [--output-dir OUTPUT_DIR] [--public-key-file-path PUBLIC_KEY_FILE_PATH | --public-key-id PUBLIC_KEY_ID]
                        input_file

Create images, configurations and session templates.

positional arguments:
  input_file            Path to the input YAML file that defines the configurations, images, and session templates to create.

optional arguments:
  -h, --help            show this help message and exit
  --dry-run, -d         Do a dry-run. Do not actually create CFS configurations, build images, customize images, or create BOS session templates, but walk through all the other steps.
  --save-files, -s      Save files that could be passed to the CFS and BOS to create CFS configurations and BOS session templates, respectively.
  --no-resolve-branches

As shown above, you can instruct SAT command to leverage the resolving branch behavior to CFS by using argument --no-resolve-branches

Manta should do the same as SAT and resolve git branches automatically, this will make the command slower but safer to run.

Important: keep the branch name in the request json payload so we can retrieve this information in the future when inspecting the CFS configuration layer details.