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

Project & Enviroment Reffrencing #6

Closed
whits91 opened this issue Sep 5, 2018 · 11 comments
Closed

Project & Enviroment Reffrencing #6

whits91 opened this issue Sep 5, 2018 · 11 comments
Labels
bug Something isn't working

Comments

@whits91
Copy link

whits91 commented Sep 5, 2018

Hi,

I've tested this, and there's an issue with the environment being created:

Exception calling "Add" with "2" argument(s): "An entry with the same key already exists." An entry with the same key already exists.

This is because the referencing between environment and project already exists.

@mmajcica
Copy link
Owner

mmajcica commented Sep 6, 2018

Are you referring to #2 ?

@whits91
Copy link
Author

whits91 commented Sep 6, 2018

Yes, it is similar to #2.

When the the option to 'Drop project before deploy' is unchecked the environment should only be added and referenced if it doesn't already exist. If the environment already exists then it should validate the config XML/JSON against the variables within the environment, either dropping ones which no longer exist, creating new variables which are not present in the environment or amended variable values if they differ.

Currently, it still looks to add the referencing between an environment and the project which is causing it to error as it already exists.

I hope i've successfully explained the issue.

@mmajcica
Copy link
Owner

mmajcica commented Sep 9, 2018

OK, thanks. I'll check and address that together with #5
If you feel comfortable, I'll also be happy to accept a PR.

@mmajcica mmajcica added the bug Something isn't working label Sep 9, 2018
@whits91
Copy link
Author

whits91 commented Sep 10, 2018

Hi,
I appreciate the offer, although taking a PR is a little out my comfort zone - I'll wait for the fix :) Is there an ETA on delivering the fix?

@mmajcica
Copy link
Owner

mmajcica commented Sep 10, 2018

Being an open source project it depends on my free time and energy. So sorry, no commitments or ETA. If this is important for you, please get in touch with me in private via http://blog.majcica.com/contact/

@whits91
Copy link
Author

whits91 commented Sep 10, 2018

I understand, thank you.

@mmajcica
Copy link
Owner

@whits91 I think I found the reason for your issue and wrote some code that should solve it. Unfortunately, I have no way to test it at the moment.
Would you be able to do so? The latest release can be found here https://github.com/mmajcica/DeploySsis/releases/tag/1.0.7

Let me know

@whits91
Copy link
Author

whits91 commented Oct 11, 2018

@mmajcica I'm struggling to apply your change to TFS cloud. I don't foresee being able to actively test it without it being published within the marketplace - Sorry

@mmajcica
Copy link
Owner

Hi @whits91
In this case, what you could do is to download the vsix file, open it with your zip app of choice and extract the task folder out of it.
Then by using Cross-platform CLI for Microsoft Team Foundation Server and Visual Studio Team Services (https://github.com/Microsoft/tfs-cli) upload the new task to your VSTS account.
With a command like this:
tfx build tasks upload --task-path ./task --auth-type pat --token 6yhymn3foxuqmsobktekvueehfhqifjt4yeldfj33v6wk4kr4idq --service-url https://yourOrg.visualstudio.com

In this way a new version of the task will be uploaded manually into VSTS. Later once I do publish the new version of extension, it will overwrite this one.

Would you be so kind to try it?

Thanks

@mmajcica
Copy link
Owner

@whits91 any updates?

@linxtong
Copy link

linxtong commented Mar 29, 2019

Hi Mario;

Hope you are doing well.
Today we deploy the projects with this task successfully at the first time. Then we did some update, and deploy it again, we got below error.
##[error]Exception calling "Add" with "2" argument(s): "An entry with the same key already exists."
An entry with the same key already exists.

Then we checked the option of "Drop project before deploy", and deploy the project, then it works.
So I thought it maybe the reference between environment and project was not deleted, when try to update the ssis project.

I test deployment with unchecked the option of "Drop project before deploy", and I deleted the reference in the SSIS DB with below sql.
delete from [internal].[environment_references]
The deployment finished successfully, could you please have a look?
I was trying to do a pull request, but I failed on test the Powershell code on my local machine.
I checked code, I think the issue may be in below code, line 423 to line 432 of file ispac.psm1

if ($project.References[$EnvironmentName])
                    {
                        Write-Verbose "Project reference for the environment $EnvironmentName already exists"
                    }
                    else                        
                    {
                        Write-Verbose "Adding environment reference for $EnvironmentName to project $($project.Name)"
                        $project.References.Add($EnvironmentName, $FolderName)
                        $project.Alter() | Out-String | Write-Verbose
                    }

Thanks every much.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants