Skip to content

Resolve KONAN-2230 "Implement publish command"#8

Merged
NourhanKhaled merged 12 commits intomainfrom
KONAN-2230
Nov 3, 2022
Merged

Resolve KONAN-2230 "Implement publish command"#8
NourhanKhaled merged 12 commits intomainfrom
KONAN-2230

Conversation

@msherif-synapse
Copy link
Copy Markdown
Collaborator

No description provided.

@msherif-synapse msherif-synapse changed the title feat: add publish command and refactor existing global config Resolve KONAN-2230 "Implement publish command" Oct 31, 2022
global_config.save()
else:
click.echo(
"Error fetching token_name and token_password for konan container registry, please try to re-login")
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we change this to

Looks like you're not logged in. Run `konan login` first then try again.

The user doesn't need to know any details of token or password or container registry.

try:
image = client.images.get(image_tag)
except ImageNotFound:
click.echo("Incorrect image provided")
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wording might be more helpful

Incorrect image provided. Make sure you provide the same image name you used with `konan build` command.

try:
image = client.images.get(click.prompt("Image tag"))
except ImageNotFound:
click.echo("Incorrect image provided")
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use same message suggested above.

return
else:
click.echo(
"Error reading local configs, please navigate to project file and make sure you initialized your project using init command")
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we can make this similar to the django error if manage.py is not found? The user doesn't know what's a local config

model.config.json does not exist in the current directory. Make sure you're running this command from the same directory you ran 'konan init'.

for chunk in result:
if 'progress' in chunk:
click.echo(chunk['progress'])
click.echo('Image uploaded successfully')
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
click.echo('Image uploaded successfully')
click.echo('Image pushed successfully')

image = client.images.get(local_config.latest_built_image)
else:
try:
image = client.images.get(click.prompt("Image tag"))
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
image = client.images.get(click.prompt("Image tag"))
image = client.images.get(click.prompt("Image name"))

for consistency with the arg of the build command

if LocalConfig.exists(DEFAULT_LOCAL_CFG_PATH):
local_config = LocalConfig(**LocalConfig.load(DEFAULT_LOCAL_CFG_PATH), new=False)
if local_config.latest_built_image:
if click.confirm("Do you want to use the latest built image?"):
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we somehow also echo its name?

Copy link
Copy Markdown
Collaborator

@NourhanKhaled NourhanKhaled left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

# Conflicts:
#	konan_cli/main.py
@NourhanKhaled NourhanKhaled merged commit bdcfdf9 into main Nov 3, 2022
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