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

manifest creation helper #1090

Closed
shadeofblue opened this issue Jan 23, 2023 · 2 comments · Fixed by #1103
Closed

manifest creation helper #1090

shadeofblue opened this issue Jan 23, 2023 · 2 comments · Fixed by #1103
Assignees

Comments

@shadeofblue
Copy link
Contributor

shadeofblue commented Jan 23, 2023

Add helper API for manifests,

Based on the schema described in GAP-4:
https://github.com/golemfactory/golem-architecture/blob/master/gaps/gap-4_comp_manifest/gap-4_comp_manifest.md
and GAP-5
https://github.com/golemfactory/golem-architecture/blob/master/gaps/gap-5_payload_manifest/gap-5_payload_manifest.md

implement a Manifest class that:

  • creates an internal, object representation of the Manifest
  • populates the representation with all elements that are able to be added automatically and are required by the schema
  • allows the user to modify the manifest interactively (e.g. add outbound urls)
  • enables serialization of the manifest
  • provides a helper to do all of the above easily, e.g.:
manifest = Manifest(image_hash="sha3:05270a8a938ff5f5e30b0e61bc983a8c3e286c5cd414a32e1a077657", properties={"net.inet.out.urls": ["http://bor.golem.network"]})

json.dumps(manifest)

{
  "version": "0.1.0",
  "createdAt": "2022-12-01T00:00:00.000000Z",
  "expiresAt": "2100-01-01T00:00:00.000000Z",
  "payload": [
    {
      "platform": {
        "arch": "x86_64",
        "os": "linux"
      },
      "urls": [
        "http://girepo.dev.golem.network:8000/docker-gas_scanner_backend_image-latest-91c471517a.gvmi"
      ],
      "hash": "sha3:05270a8a938ff5f5e30b0e61bc983a8c3e286c5cd414a32e1a077657"
    }
  ],
  "compManifest": {
    "version": "0.1.0",
    "script": {
      "commands": [
        "run .*"
      ],
      "match": "regex"
    },
    "net": {
      "inet": {
        "out": {
          "protocols": [
            "http"
          ],
          "urls": [
            "http://bor.golem.network"
          ]
        }
      }
    }
  }
}

@approxit approxit self-assigned this Feb 16, 2023
@approxit approxit linked a pull request Feb 16, 2023 that will close this issue
@shadeofblue shadeofblue self-assigned this Feb 27, 2023
@shadeofblue
Copy link
Contributor Author

@approxit

the defaults to be used:

{
    "version": "",
    "createdAt": [ CURRENT DATE TIME ],
    "expiresAt": "2100-01-01T00:01:00.000000Z",
    "payload": [
      {
        "platform": {
          "arch": "x86_64",
          "os": "linux"
        },
        "urls": [ BASED ON THE RESOLVED VALUE FROM THE HASH - or through a directly provided value],
        "hash": [ (for now) MUST BE PROVIDED BY THE USER, may change when we switch to using tags ] 
      }
    ],
    "compManifest": {
      "version": "",

[ only "run" allowed by default, user may, of course override this ] 

      "script": {
        "commands": [
          "run .*",
        ],
        "match": "regex"
      },

[ "net" section not included by default - must be constructed when a user passes a list of URLs] 

    }
}

@shadeofblue shadeofblue removed their assignment Mar 1, 2023
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 a pull request may close this issue.

2 participants