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

feat(acrcssc): Use next occurrence outputted by ACR Tasks #4

Open
wants to merge 2 commits into
base: cegraybl/cssc_phase_1.5
Choose a base branch
from

Conversation

stevenhvtran
Copy link

@stevenhvtran stevenhvtran commented Jan 22, 2025


This checklist is used to make sure that common guidelines for a pull request are followed.

Related command

General Guidelines

  • Have you run azdev style <YOUR_EXT> locally? (pip install azdev required)
  • Have you run python scripts/ci/test_index.py -q locally? (pip install wheel==0.30.0 required)
  • My extension version conforms to the Extension version schema

For new extensions:

About Extension Publish

There is a pipeline to automatically build, upload and publish extension wheels.
Once your pull request is merged into main branch, a new pull request will be created to update src/index.json automatically.
You only need to update the version information in file setup.py and historical information in file HISTORY.rst in your PR but do not modify src/index.json.

@cegraybl cegraybl requested a review from Copilot January 24, 2025 23:54
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot reviewed 1 out of 2 changed files in this pull request and generated 1 comment.

Files not reviewed (1)
  • src/acrcssc/azext_acrcssc/templates/arm/CSSC-AutoImagePatching-encodedtasks.json: Language not supported
Comments suppressed due to low confidence (1)

src/acrcssc/azext_acrcssc/helper/_taskoperations.py:75

  • The variable 'next_date' is used before it is assigned a value in some cases. This can lead to a NoneType error. Ensure 'next_date' is properly assigned before it is used.
if next_date is None:

task = get_task(cmd, registry, CONTINUOUSPATCH_TASK_SCANREGISTRY_NAME)
trigger = task.trigger
if trigger and trigger.timer_triggers:
schedule_cron_expression = trigger.timer_triggers[0].schedule
# Note (transteven): I think additional_properties is needed here because nextOccurrence isn't officially in ARM Manifest yet
next_date = trigger.timer_triggers[0].additional_properties["nextOccurrence"]
Copy link
Preview

Copilot AI Jan 24, 2025

Choose a reason for hiding this comment

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

Accessing 'additional_properties["nextOccurrence"]' without checking if the key exists can raise a KeyError. Add a check to ensure the key exists before accessing it.

Suggested change
next_date = trigger.timer_triggers[0].additional_properties["nextOccurrence"]
if 'nextOccurrence' in trigger.timer_triggers[0].additional_properties: next_date = trigger.timer_triggers[0].additional_properties['nextOccurrence']

Copilot is powered by AI, so mistakes are possible. Review output carefully before use.

Positive Feedback
Negative Feedback

Provide additional feedback

Please help us improve GitHub Copilot by sharing more details about this comment.

Please select one or more of the options

Choose a reason for hiding this comment

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

valid since the Task API needs to be released and referenced on the client

@cegraybl
Copy link

LGTM but we need to wait for the Task API release with the new property, and reference the new version in cf_acr_tasks on _client_factory.py

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.

2 participants