punchplatform / punchbox

the punchbox tool to deploy servers, kubernetes or punch
Apache License 2.0
4 stars 2 forks source link

Deployement offline #29

Closed tgounouf closed 3 years ago

tgounouf commented 3 years ago

Hello,

We use punchbox 6.1 on private network without git access, and we have an error during validation step.

INFO: loading user configuration from file /punchplatform-deployer/6.1.0/complete_punch_32G.json
fatal: Not a git repository (or any of the parent directories): .git
Traceback (most recent call last):
  File "/opt/punchbox-6.1/bin/pex/punchbox_pex/punchbox.pex/.bootstrap/pex/pex.py", line 393, in execute
  File "/opt/punchbox-6.1/bin/pex/punchbox_pex/punchbox.pex/.bootstrap/pex/pex.py", line 325, in _wrap_coverage
  File "/opt/punchbox-6.1/bin/pex/punchbox_pex/punchbox.pex/.bootstrap/pex/pex.py", line 356, in _wrap_profiling
  File "/opt/punchbox-6.1/bin/pex/punchbox_pex/punchbox.pex/.bootstrap/pex/pex.py", line 441, in _execute
  File "/opt/punchbox-6.1/bin/pex/punchbox_pex/punchbox.pex/.bootstrap/pex/pex.py", line 494, in execute_interpreter
  File "/opt/punchbox-6.1/bin/pex/punchbox_pex/punchbox.pex/.bootstrap/pex/pex.py", line 530, in execute_content
  File "/opt/punchbox-6.1/bin/pex/punchbox_pex/punchbox.pex/.bootstrap/pex/compatibility.py", line 77, in exec_function
  File "/opt/punchbox-6.1/bin/punchbox.py", line 337, in <module>
    main()
  File "/opt/punchbox-6.1/bin/punchbox.py", line 327, in main
    import_validation_resources(parser.parse_args().punch_validation_config, parser.parse_args().platform_config_file)
  File "/opt/punchbox-6.1/bin/punchbox.py", line 246, in import_validation_resources
    branch= subprocess.check_output(["git", "rev-parse", "--abbrev-ref", "HEAD"], cwd=ppunch_dir).strip().decode(),
  File "/usr/local/lib/python3.6/subprocess.py", line 356, in check_output
    **kwargs).stdout
  File "/usr/local/lib/python3.6/subprocess.py", line 438, in run
    output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['git', 'rev-parse', '--abbrev-ref', 'HEAD']' returned non-zero exit status 128.
status: 1

Can you permit to do validation step offline ?

jmerdy commented 3 years ago

Bonjour, Je relance le ticket. Etant bloqué avec la dernière version de la punchbox sur ce point j'ai modifié le fichier puncbox.py. en passant de

render = template.render(
                        spark_master= platform_config["punch"]["spark"]["masters"][0],
                        elasticsearch_host= platform_config["punch"]["elasticsearch"]["servers"][0],
                        shiva_host=platform_config["punch"]["shiva"]["servers"][0],
                        validation_id= int(datetime.now().timestamp()),
                        validation_time= datetime.now().isoformat(timespec="seconds"),
                        nb_to_validate= len([f for f in os.listdir(tenant_validation_dir)]),
                        livedemo_api_url= livedemo_api_url,
                        user= os.getenv('USER', default='anonymous'),
                        sysname= os.uname().sysname,
                        release= os.uname().release,
                        hostname= os.uname().nodename,
                        vagrant_config= os.path.basename(platform_config_file),
                        vagrant_os= platform_config["targets"]["meta"]["os"],
                        gateway_host= platform_config["punch"]["gateway"]["servers"][0],
                        branch= subprocess.check_output(["git", "rev-parse", "--abbrev-ref", "HEAD"], cwd=ppunch_dir).strip().decode(),
                        commit= subprocess.check_output(["git", "rev-parse", "--short", "HEAD"], cwd=ppunch_dir).strip().decode(),
                        commit_date= subprocess.check_output(["git","log","-1","--date=format:%Y-%m-%dT%H:%M","--format=%ad"],cwd=ppunch_dir).strip().decode())

à

render = template.render(
                        spark_master= platform_config["punch"]["spark"]["masters"][0],
                        elasticsearch_host= platform_config["punch"]["elasticsearch"]["servers"][0],
                        shiva_host=platform_config["punch"]["shiva"]["servers"][0],
                        validation_id= int(datetime.now().timestamp()),
                        validation_time= datetime.now().isoformat(timespec="seconds"),
                        nb_to_validate= len([f for f in os.listdir(tenant_validation_dir)]),
                        livedemo_api_url= livedemo_api_url,
                        user= os.getenv('USER', default='anonymous'),
                        sysname= os.uname().sysname,
                        release= os.uname().release,
                        hostname= os.uname().nodename,
                        vagrant_config= os.path.basename(platform_config_file),
                        vagrant_os= platform_config["targets"]["meta"]["os"],
                        gateway_host= platform_config["punch"]["gateway"]["servers"][0],
                        branch= "6.1",
                        commit= "37d8dd1",
                        commit_date= "2020-09-28T14:41")

Cela fonctionne bien pour un patch provisoire.