forcedotcom / devops-center-feedback

61 stars 2 forks source link

When refreshing a connected sandbox, the source tracking is lost #143

Open dharrisMedable opened 2 years ago

dharrisMedable commented 2 years ago

Describe the bug When refreshing a connected sandbox, the source tracking is lost.

To Reproduce Steps to reproduce the behavior:

  1. Refresh an existing sandbox on an active project/pipeline
  2. When pulling changes from a Work Item, you are prompted to re-authenticate the DevOps Center connection
  3. Once authenticated, no new changes are pulled, as if the source tracking connection is lost post refresh

Expected behavior Once a sandbox is refreshed, it is expected to re-authenticate, but the hope is that this re-authentication would reconnect the source tracking, clear out the past source tracking log, and start tracking new changes

Screenshots N/A

Additional context Is the best practice to not use a Project for evergreen modifications? We typically do our work as first-in/first-out and not necessarily Project based, so our sandbox refreshes do not follow a specific cadence aligned with full Project go lives.

kylewalke commented 2 years ago

Hello @dharrisMedable, I have a few questions if you wouldn't mind clarifying to help me understand. When you do your sandbox refresh and authenticate do you mean that the old pulled changes that used to be present on the old work items are no longer present? If you make any changes to metadata and then pull changes again, does only the new metadata show up and not the older changes from pre-refresh? Is there something missing from the DOCe's backsyncing process that makes doing sandbox refreshes over backsyncs preferable?

dharrisMedable commented 2 years ago

"When you do your sandbox refresh and authenticate do you mean that the old pulled changes that used to be present on the old work items are no longer present?" --After we refresh, the old pulled changes are still present, but it will not pull any new metadata changes that were made in the sandbox post-refresh when we click "pull changes."

"If you make any changes to metadata and then pull changes again, does only the new metadata show up and not the older changes from pre-refresh?" --It will not not pull any new metadata changes made to the sandbox post-refresh when we click "pull changes."

Is there something missing from the DOCe's backsyncing process that makes doing sandbox refreshes over backsyncs preferable? --Not too sure if I understand this question, we would just expect to start seeing new metadata changes in the list post-refresh so we can promote the changes through the pipeline.

kylewalke commented 2 years ago

Thank you for the additional information as that definitely is unexpected behaviour. @GilsonCanario can we mark this one as a Bug please?

Is there something missing from the DOCe's backsyncing process that makes doing sandbox refreshes over backsyncs preferable? --Not too sure if I understand this question, we would just expect to start seeing new metadata changes in the list post-refresh so we can promote the changes through the pipeline.

I was trying to see if there was a reason that back-syncing the changes from other environments was insufficient to synchronize your sandboxes. If back-syncing fully filled your synchronization needs, this would mean that refreshing the sandbox is unnecessary in most scenarios since the environments are kept in sync through the DOCe and this problem could be sidestepped to some extent. Of course, not every situation is ideal and there will still be need to refresh from time to time so this bug still makes sense for us to nail down. But I would also like to highlight any possible holes in our process if possible to harden our back-sync process.

dharrisMedable commented 2 years ago

Ah, I get what you are saying, in the perfect instance of keeping everything in sync. But yeah, there could be some situations where a simple refresh would be nice.

Thank you for noting the bug!

kylewalke commented 2 years ago

Hello @dharrisMedable, after some more investigation and speaking with some other team members we have determined a workaround for your problem. What you will need to do is

  1. Go into Setup and locate the section for Named Credentials
  2. Change the URL of the Named Credential record related to the target development (Environment__c) record which was refreshed. Merely appending a few characters to the end is sufficient, it only has to be different to the original URL.
  3. Return to DOCe and add a new Environment as a development environment.
  4. Login to the refreshed sandbox and authorize as usual.
  5. (Optional) Rename the old Env something else like "Deprecated" or "Do Not Use" and Name the new dev env the same thing as the old one for consistency.

By the end when you connect a Work Item to this 'new' env, the source tracking should be re-enabled and all should be well again. Please let us know if this works or if you have any other questions!

NickSaiben commented 1 year ago

I'm also experiencing the same issue @dharrisMedable mentioned. I'll try the workaround @kylewalke proposed.