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

New action #77

Merged
merged 9 commits into from
Jan 16, 2025
Merged

New action #77

merged 9 commits into from
Jan 16, 2025

Conversation

lexbritvin
Copy link
Collaborator

No description provided.

@davidferlay
Copy link
Contributor

Solves launchrctl/web#44 + #70 and bring some other goodies

@davidferlay
Copy link
Contributor

davidferlay commented Jan 2, 2025

Testing with all plugins:

plasmactl build --no-cache -t 500s --tag nethttpomithttp2 -vvv \
-p github.com/launchrctl/compose@new-action \
-p github.com/launchrctl/keyring@new-action \
-p github.com/launchrctl/launchr@new-action \
-p github.com/launchrctl/web@new-action \
-p github.com/skilld-labs/plasmactl-bump/v2@new-action \
-p github.com/skilld-labs/plasmactl-dependencies@new-action \
-p github.com/skilld-labs/plasmactl-meta@new-action \
-p github.com/skilld-labs/plasmactl-package@new-action \
-p github.com/skilld-labs/plasmactl-publish@new-action \
-p github.com/skilld-labs/plasmactl-update@new-action \
-p github.com/launchrctl/web@new-action \
-n plasmactl -o plasmactl --build-version v0.0.0

Reminder: need to also test in CI

@davidferlay
Copy link
Contributor

davidferlay commented Jan 2, 2025

Plugin commands:

All ok Command Code review Functional test
keyring:login
keyring:logout
keyring:purge
keyring:set
keyring:unset
compose
compose:add
compose:delete
compose:update
build
help
bump
bump --dry-run
bump --sync
bump --sync --dry-run
dependencies
package
publish
update
meta
web
completion

Local actions:

All ok Command Code review Functional test
platform:data-bus sub
platform:data-bus pub
platform:event-bus sub
platform:event-bus pub
platform:deploy
platform:nodes
platform:release
platform:sshconfig
platform:var-get
platform:var-set
platform:variables-check
platform:vault
platform.entities.timelog:diff show
cognition.services.data-relay-events:config-advisor

@davidferlay
Copy link
Contributor

  • help command is listed in --help but ./plasmactl help does not actually seem to exist, so helper is misleading and probably it should not be listed there. It is also, correctly, already listed as --help

@davidferlay
Copy link
Contributor

davidferlay commented Jan 2, 2025

-completion command does not provide any info about required arguments as it use to :
now

$ ./plasmactl completion
Usage:
  plasmactl [flags]

Flags:
  -h, --help                        help for plasmactl
      --keyring-passphrase string   Passphrase for keyring encryption/decryption
      --log-format LogFormat        log format, may be pretty, plain or json (default pretty)
  -q, --quiet                       disable output to the console
  -v, --verbose count               log verbosity level, use -vvvv DEBUG, -vvv INFO, -vv WARN, -v ERROR
      --version                     version for plasmactl

before

$ pl completion              
Generate the autocompletion script for plasmactl for the specified shell.
See each sub-command's help for details on how to use the generated script.

Usage:
  plasmactl completion [command]

Available Commands:
  bash        Generate the autocompletion script for bash
  fish        Generate the autocompletion script for fish
  powershell  Generate the autocompletion script for powershell
  zsh         Generate the autocompletion script for zsh

Flags:
  -h, --help   help for completion

Global Flags:
      --keyring-passphrase string   Passphrase for keyring encryption/decryption
      --log-format LogFormat        log format, may be plain or json
  -q, --quiet                       disable output to the console
  -v, --verbose count               log verbosity level, use -vvvv DEBUG, -vvv INFO, -vv WARN, -v ERROR

Use "plasmactl completion [command] --help" for more information about a command.

@davidferlay
Copy link
Contributor

  • platform:data-bus sub local action fails:

Currently:

➜  ski-platform git:(master) ./plasmactl platform:data-bus sub "platform.foundation.network.ingress.web.web-ingress.log" --cluster prod
SSH_AUTH_SOCK=/tmp/socket; export SSH_AUTH_SOCK;
SSH_AGENT_PID=8; export SSH_AGENT_PID;
echo Agent pid 8;
2025/01/03 15:31:28 open <nil>: no such file or directory
  ERROR   action "platform:data-bus" finished with exit code 1

Expected:

➜  ski-platform git:(master) plasmactl platform:data-bus sub "platform.foundation.network.ingress.web.web-ingress.log" --cluster prod
Enter passphrase to unlock the keyring: 
SSH_AUTH_SOCK=/tmp/socket; export SSH_AUTH_SOCK;
SSH_AGENT_PID=8; export SSH_AGENT_PID;
echo Agent pid 8;
Enter passphrase for /tmp/id_rsa: Identity added: /tmp/id_rsa (/tmp/id_rsa)
# 163.172.103.62:1337 SSH-2.0-OpenSSH_9.1
# 163.172.103.62:1337 SSH-2.0-OpenSSH_9.1
# 163.172.103.62:1337 SSH-2.0-OpenSSH_9.1
# 163.172.103.62:1337 SSH-2.0-OpenSSH_9.1
# 163.172.103.62:1337 SSH-2.0-OpenSSH_9.1
{
  "topic": "platform.foundation.network.ingress.web.web-ingress.log",
  "key": "platform.foundation.network.ingress.web.web-ingress.log",
(...)

@davidferlay
Copy link
Contributor

  • platform:event-bus sub local action fails:

Currently:

➜  ski-platform git:(master) ./plasmactl platform:event-bus sub ">" --cluster prod
SSH_AUTH_SOCK=/tmp/socket; export SSH_AUTH_SOCK;                                  
SSH_AGENT_PID=8; export SSH_AGENT_PID;
echo Agent pid 8;
2025/01/03 15:40:08 open <nil>: no such file or directory
  ERROR   action "platform:event-bus" finished with exit code 1

Expected:

➜  ski-platform git:(master) plasmactl platform:event-bus sub ">" --cluster prod | tee /tmp/data
Enter passphrase to unlock the keyring: 
SSH_AUTH_SOCK=/tmp/socket; export SSH_AUTH_SOCK;
SSH_AGENT_PID=8; export SSH_AGENT_PID;
echo Agent pid 8;
Enter passphrase for /tmp/id_rsa: Identity added: /tmp/id_rsa (/tmp/id_rsa)
# 163.172.103.62:1337 SSH-2.0-OpenSSH_9.1
# 163.172.103.62:1337 SSH-2.0-OpenSSH_9.1
# 163.172.103.62:1337 SSH-2.0-OpenSSH_9.1
# 163.172.103.62:1337 SSH-2.0-OpenSSH_9.1
# 163.172.103.62:1337 SSH-2.0-OpenSSH_9.1
2025/01/03 15:40:05 Listening on [>]
2025/01/03 15:40:14 [#1] Received on [platform.conversation.utterance-relay.utterances.rooms]
(...)

@davidferlay
Copy link
Contributor

davidferlay commented Jan 3, 2025

  • platform:nodes local action fails:

Currently:

➜  ski-platform git:(master) ./plasmactl platform:nodes                           
Proceeding with execution, please wait...              
/bin/sh: syntax error: unexpected end of file

  ERROR   action "platform:nodes" finished with exit code 2

Expected:

➜  ski-platform git:(master) plasmactl platform:nodes        
                                       
Proceeding with execution, please wait...
Successfully created cache in library/inventories/platform_nodes
(...)

@davidferlay
Copy link
Contributor

davidferlay commented Jan 3, 2025

  • platform:release local action does not behave as expected: see the nil at bottom and lack of user prompt

Currently:

➜  ski-platform git:(master) ./plasmactl platform:release       

Last tag is: 3.8.0

## What's Changed:
- 14eca1ec9d92d Updating pla-plasma package to version 1.85.1
(...)

Creating tag: <nil>
Press 'Enter' to push new tag to repo

Expected:

➜  ski-platform git:(master) plasmactl platform:release   
                                       
Last tag is: 3.8.0

## What's Changed:
- 14eca1ec9d92d Updating pla-plasma package to version 1.85.1
(...)

1) Fix: Safe to upgrade, bugfixes (3.8.1)
2) Feature: Safe to update, new features (3.9.0)
3) Breaking: Not safe to update (4.0.0)

Please enter your choice:    
(...)

@davidferlay
Copy link
Contributor

  • platform:sshconfig local action fails:

Currently:

➜  ski-platform git:(master) ./plasmactl platform:sshconfig 
➜  ski-platform git:(master) 

(no output)

Expected:

➜  ski-platform git:(master) plasmactl platform:sshconfig                
Host plasma-sandbox-1-114287-control
(...)

@davidferlay
Copy link
Contributor

  • platform:var-get local action fails:

Currently:

➜  ski-platform git:(master) ./plasmactl platform:var-get academy_port
Error: no "<nil>" found in "environment" config
ERROR:write() argument must be str, not None

Expected:

➜  ski-platform git:(master) plasmactl platform:var-get academy_port
Enter passphrase to unlock the keyring: 

academy_port: 80

@davidferlay
Copy link
Contributor

  • platform:variables-check local action fails:

Currently:

➜  ski-platform git:(master) ./plasmactl platform:variables-check
Testing variables for <nil> environment...
Error: no "<nil>" found in "environment" config
Traceback (most recent call last):
  File "/action/action.py", line 65, in <module>
    VariablesAction(**vars(parser.parse_args())).exec()
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/action/action.py", line 22, in __init__
    self._env.set_cluster()
  File "/host/library/actions/environment/module.py", line 44, in set_cluster
    f.write(cluster)
TypeError: write() argument must be str, not None
  ERROR   action "platform:variables-check" finished with exit code 1

Expected:

➜  ski-platform git:(master) plasmactl platform:variables-check
Enter passphrase to unlock the keyring:                        
Testing variables for dev environment...
Executing all tests:
- Report what default variables definitions are missing
- Report what variables definitions are missing
- Report what variables are defined but never used
- Report what variables definitions are duplicated
(...)

@davidferlay
Copy link
Contributor

  • platform.entities.timelog:diff show local action fails:

Currently:

➜  ski-platform git:(master) ./plasmactl platform.entities.timelog:diff show --gitlab-token XXX --gitlab-url https://xxx:[email protected]/api/v4 --odoo-password XXX --odoo-url https://xxx:[email protected] 

(hangs indefinitely)

Expected:

➜  ski-platform git:(master) plasmactl platform.entities.timelog:diff show --gitlab-token XXX --gitlab-url https://xxx:[email protected]/api/v4 --odoo-password XXX --odoo-url https://xxx:[email protected]
                             
2025/01/03 16:08:55 creating show_output_1735920535 directory that will contain show differences and sources timelogs
2025/01/03 16:08:55 Collection GitLab logs...
2025/01/03 16:08:55 Collecting GitLab logs from 2025-01-01T00:00:00Z to 2025-02-01T00:00:00Z
(...)

@davidferlay
Copy link
Contributor

  • platform:deploy local action fails:

Currently:

➜  ski-platform git:(master) ./plasmactl platform:deploy dev tag
Configuring dev environment...           
Building tag...

Error: Incorrect passphrase

  ERROR   action "platform:deploy" finished with exit code 1

Expected:

➜  ski-platform git:(master) plasmactl platform:deploy dev tag
Configuring dev environment...
Building tag...
Identity added: /tmp/.ansible-runner-vp23wxoz/artifacts/build_action/ssh_key_data (/tmp/.ansible-runner-vp23wxoz/artifacts/build_action/ssh_key_data)

(...)

@davidferlay
Copy link
Contributor

davidferlay commented Jan 6, 2025

  • platform:data-bus pub local action fails:

Currently:

➜  ski-platform git:(master) ./plasmactl platform:data-bus pub "platform.foundation.network.ingress.web.web-ingress.log" --message "TEST" 
SSH_AUTH_SOCK=/tmp/socket; export SSH_AUTH_SOCK;
SSH_AGENT_PID=8; export SSH_AGENT_PID;
echo Agent pid 8;
2025/01/06 10:11:18 config library/inventories/platform_nodes/configuration/<nil>.yaml doesn't exist
  ERROR   action "platform:data-bus" finished with exit code 

Expected:

➜  ski-platform git:(master) pl platform:data-bus pub "platform.foundation.network.ingress.web.web-ingress.log" --message "TEST"
Enter passphrase to unlock the keyring: 
SSH_AUTH_SOCK=/tmp/socket; export SSH_AUTH_SOCK;
SSH_AGENT_PID=8; export SSH_AGENT_PID;
echo Agent pid 8;
Enter passphrase for /tmp/id_rsa: Identity added: /tmp/id_rsa (/tmp/id_rsa)
# 51.159.2.47:1337 SSH-2.0-OpenSSH_9.7
# 51.159.2.47:1337 SSH-2.0-OpenSSH_9.7
# 51.159.2.47:1337 SSH-2.0-OpenSSH_9.7
# 51.159.2.47:1337 SSH-2.0-OpenSSH_9.7
# 51.159.2.47:1337 SSH-2.0-OpenSSH_9.7
(...)

@davidferlay
Copy link
Contributor

  • platform:event-bus pub local action fails:

Currently:

➜  ski-platform git:(master) ./plasmactl platform:event-bus pub "test" --message "xxxx"
SSH_AUTH_SOCK=/tmp/socket; export SSH_AUTH_SOCK;                                       
SSH_AGENT_PID=8; export SSH_AGENT_PID;
echo Agent pid 8;
2025/01/06 10:15:24 config library/inventories/platform_nodes/configuration/<nil>.yaml doesn't exist
  ERROR   action "platform:event-bus" finished with exit code 1

Expected:

➜  ski-platform git:(master) pl platform:event-bus pub "test" --message "xxxx"               
Enter passphrase to unlock the keyring:                                       
SSH_AUTH_SOCK=/tmp/socket; export SSH_AUTH_SOCK;
SSH_AGENT_PID=8; export SSH_AGENT_PID;
echo Agent pid 8;
Enter passphrase for /tmp/id_rsa: Identity added: /tmp/id_rsa (/tmp/id_rsa)
# 51.159.2.47:1337 SSH-2.0-OpenSSH_9.7
# 51.159.2.47:1337 SSH-2.0-OpenSSH_9.7
# 51.159.2.47:1337 SSH-2.0-OpenSSH_9.7
# 51.159.2.47:1337 SSH-2.0-OpenSSH_9.7
# 51.159.2.47:1337 SSH-2.0-OpenSSH_9.7
2025/01/06 10:14:56 Published [test] : 'xxxx'
(...)

@lexbritvin
Copy link
Collaborator Author

  • help command is listed in --help but ./plasmactl help does not actually seem to exist, so helper is misleading and probably it should not be listed there. It is also, correctly, already listed as --help

It always worked like that, it's better to create another issue for that, not a regression.

-completion command does not provide any info about required arguments as it use to : now

Completion was never supported. It kind of worked for cobra actions. Should be resolved in #27

@lexbritvin
Copy link
Collaborator Author

For nil errors in actions, please, update all action options with default: [value]. Now, if default is not set, then there is no default value. It gives more flexibility for the input.

@iignatevich
Copy link
Collaborator

for skilld-labs/plasmactl-bump#69
instead of dynamic progress bar depending on verbosity (-v), it will be shown when option --show-progress passed.
Still, bar requires additional work as currently it doesn't look good in CI. And behavior can be redone from option to something else.

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.

3 participants