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

Suggestions on how to implement in build pipeline #51

Closed
cenx1 opened this issue Jun 4, 2020 · 10 comments
Closed

Suggestions on how to implement in build pipeline #51

cenx1 opened this issue Jun 4, 2020 · 10 comments

Comments

@cenx1
Copy link

cenx1 commented Jun 4, 2020

I think this project is becoming very good and I am starting to use it in a build pipeline. I would like to ask if there are any thoughts on how this can be achieved?

I want to be able to execute a build from a GitLab Runner / Azure DevOps Agent / GitHub ... / Other commandline tools. Is it possible to invoke the Version Control add-in from commandline with parameters somehow?

@joyfullservice
Copy link
Owner

Great ideas! Here are a few initial thoughts...

You could use the /x and /cmd command line parameters when launching Access to run a specific procedure, such as a function to build a database from source. If you launched the add-in file, you could pass it the path of a function to run a silent build on a specified path of source files.

In the same way that we have a place to specify a sub to run after build, we could add a new option where you would specify a function name to validate the build after restarting the newly-built database. The add-in would be expecting the validation function in the new database to return True after a successful build. The add-in could then return this status to the pipeline.

I have done some work with GitLab pipelines, and I could see this working out very nicely on a GitLab runner on Windows box to build and validate the database automatically when a commit is pushed to the repository. On a successful build, this pipeline could roll to the next task and deploy the database for the end users.

If you are interested, I have some scripts that build a click-once installer around a Microsoft Access database application in a fully automated way. When the user opens the program, it automatically updates to the latest version if a new one has been deployed. I have been using this for several years and it has worked great in our environment.

Since this automated deployment pipeline for Microsoft Access via GitLab is a bit outside the scope of this particular project, I could see this being its own separate repository, and we would add functionality to the Version Control add-in to integrate nicely with it, but keeping the development efforts focused separately on the two integrated but independent projects.

@joyfullservice
Copy link
Owner

As to how to launch the add-in from VBA code before it has been loaded, I have not been able to find any documentation on how this can be done for a Microsoft Access add-in. That being said, I did a little testing, and the following code seems to provide the same functionality of loading the add-in project like what you see the first time you launch Version Control from the add-ins menu.

With References
	.AddFromFile Environ$("AppData") & "\Microsoft\AddIns\Version Control.accda"
	.Remove references("MSAccessVCS")
End With
Run "MSAccessVCS.AddInMenuItemLaunch"

@cenx1
Copy link
Author

cenx1 commented Jun 8, 2020

Thanks for the info. I will try it out today.

Great idea with a post build hook for vallidation btw. 👍

I would be very interested in seeing what you have done and I agree that it might be out of scope for this project.

@joyfullservice
Copy link
Owner

Sounds good! Would you like to create a project called msaccess-devops? Then I can fork the project and upload what I have, and you can build out from there.

@cenx1
Copy link
Author

cenx1 commented Jun 8, 2020

Awsome! I have created this project as you suggested: https://github.com/cenx1/msaccess-devops

I have not had a break through on the tips you gave me yet. When I add the reference and start a build, the SetTimer callback does not work. I believe this is because when adding a reference instead of activating an add-in the code gets added to the CurrentDb and hence closed when the build is running. Does that make sense?

@joyfullservice
Copy link
Owner

joyfullservice commented Jun 8, 2020

Yes, I think you are probably correct that loading the temporary reference to the add-in will not persist when the CurrentDB is closed. I posted a question on StackOverflow to see if one of the Access experts out there knows how to invoke an add-in.

@joyfullservice
Copy link
Owner

Just an update here... I received a helpful clue today from the StackOverflow post, and it looks like we have a way to load the add-in at the application level! This means that conceptually we can now couple these processes together in a fully automated unattended runner process that builds, validates, and deploys the application automatically from the commit!

@cenx1
Copy link
Author

cenx1 commented Jul 1, 2020

Thank you very much Adam for your effort in this!

I just tested the steps and have it working now in a prototype. 😄

@joyfullservice
Copy link
Owner

@cenx1 - I have an open pull request on cenx1/msaccess-devops with the initial code base for this project. (I believe you were able to use this to develop your prototype.) When you get a chance, it would be awesome if you were able to accept the pull request, and share some of your updates and enhancements, and perhaps also the .yaml file in your devops project. I think there are several of us that would be interested in using this in our internal environments. Through the GitHub project we can continue to collaborate and enhance the project to benefit everyone.

I will go ahead and close this issue out now, since further developments on the DevOps side will be targeting the new msaccess-devops project. Thanks again for your contributions to the community!!

@AlexHedley
Copy link

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

No branches or pull requests

3 participants