Where is this Capistrano deploy task found? - capistrano3

I'm going through the Capistrano flow examples because my boss wants to remove Capistrano from the deployment process, don't ask me why, so I want to replicate the process but on a manual basis 😕🤦 Anyways I'm looking for the deploy:set_shared_assets task but I can't find it within the git repo. Does anyone know where this is located?
I just want to find out what each step does under the hood.

if you're looking this https://github.com/capistrano/capistrano/blob/master/docs/documentation/getting-started/flow/index.markdown, maybe it's not up to date. Here is the last occurrence that I found https://github.com/capistrano/rails/blob/v1.1.0/lib/capistrano/tasks/assets.rake

Related

How to create Salesforce incremental package.xml automatically?

Does anyone experiment in creating salesforce Package.xml automatically for continuous integration? If there any script or some idea please share.
You know incremental package.xml helps to deploy only the modified files rather than using complete package.xml that redeploy unmodified files as well which takes a lot of time.
Thanks in advance!
Tricky. And not really a programming-related problem, consider cross-posting this to https://salesforce.stackexchange.com/ or maybe even https://devops.stackexchange.com/
I don't think there's no clear answer, you'll have to experiment. Especially that you tagged "migration tool" (so old-school, battle-tested but lower priority Metadata API; seems that all focus is now on SFDX style of deployments). Do you use any version control (ideally Git) or do you hope to somehow compare source & target org, figure out the deltas and deploy only them?
Remember that often SF gets better at detecting "no changes" with every release (how old is your migration tool's jar file?). For example when I deploy my current project to an empty sandbox (exact copy of prod, no custom objects, code etc yet) the initial deploy takes ~7 minutes. But any subsequent deploy with same content or slight changes takes just 3-4. So try to calculate time lost in the grand scheme of things and decide what gains you want to see / how much time you want to spend on experimenting and tweaking the solution.
You could look into dedicated deployment solutions such as Gearset, Autorabit, Odaseva (I'm not affiliated with either and this list is not exhaustive). They often are capable of running a comparison for you.
There are several projects that try to compose package.xml based on Git diff(erence) between two commits. Of course you need to have a repo first and some regime:
https://github.com/cloudsandbox/sfdx-gen-pack saw presentation about it at Cloudforce London 2019
https://github.com/Accenture/sfpowerkit seems to have a "diff" command (disclaimer: I used to work for Accenture but not affiliated now, haven't worked on the tool, haven't used it personally)
https://cumulusci.readthedocs.io/en/latest/ this seems to be interesting and mature. Built by SF employees, not an official tool but used to CI deploy the non-profit packages they build (maybe you heard about Non Profit Starter Pack, especially if you ever considered enabling Person Accounts). I'm not sure if they do delta deployments as such but there seems to be a command that updates package.xml with files in repository so it's a start? https://cumulusci.readthedocs.io/en/latest/tutorial.html#part-4-running-tasks
I'm not saying CumulusCI will be a silver bullet but out of these 3 seems to be most actively maintained ;) But sounds like you'd have to get familiar with SFDX (if not whole thing then at least commands to convert the project back and forth between "source" (SFDX) structure and Metadata API structure
Answering my question by myself: I found git diff master feature/vat | force-dev-tool changeset create vat working!
Thanks to Roman answered in https://salesforce.stackexchange.com/questions/184332/is-there-a-pre-build-solution-for-generating-a-package-xml-from-a-git-repo

DC/OS Mesosphere install/deploy my own application across a cluster

I am trying to deploy my own cluster using DC/OS CLI installation. Mesosphere has a huge support as there are many packages ready to install provided in Mesosphere Universe repo (https://github.com/mesosphere/universe).
However, I would like to make one step further. I am trying to install my own applications to my cluster using the DC/OS CLI installation process. To do this, as far as I understand, I need to either (i) make my application recognizable to the system repo (as the other repo packages that are provided in Universe) or (ii) make a new image that consists all my applications and modify the DC/OS script to make the installation possible.
Unfortunately, my modest knowledge is flawed and I could not find any where a clear answer to this.
Therefore, I would like to ask:
1) Is it possible to do what I am trying to do?
2) If the answer is YES, how exactly should I do? My goal is to install my awesome apps for my own purpose, not to publish them. But to add my apps as repo into Universe, it seems like I have to publish them.
It is possible! :)
Please follow these instructions

Capistrano get git commit sha1

I am writing a task for capistrano 3 and I need to get the current commit sha1. How can I read that ? Is there a variable for that ?
I have seen fetch(:sha1) in some files but this isn't working for me.
I am deploying into a docker container, and I need to tag the image with the current sha1 (and ideally, skip the deployment if there is already an image corresponding to the current sha1)
Capistrano creates a file in the deployed folder containing the git revision. In looking at the task which creates that file, we can see how it obtains the revision: https://github.com/capistrano/capistrano/blob/master/lib/capistrano/tasks/deploy.rake#L224
So, it is obtaining the revision from fetch(:current_revision).
In the git specific tasks, we can see where it is set: https://github.com/capistrano/capistrano/blob/master/lib/capistrano/scm/tasks/git.rake#L62
As a side note, Capistrano is probably not the best tool for what you are trying to do. Capistrano is useful for repeated deployments to the same server. Docker essentially is building a deployable container already containing the code. See the answers here for more detail: https://stackoverflow.com/a/39459945/3042016
Capistrano 3 is using a plugin system for the version manager application used (git, svn, etc.)
The current_revision is delegated to the version manager plugin and I don't understand how to access it...
In the meantime a dirty solution would be
set :current_revision, (lambda do
`git rev-list --max-count=1 #{fetch(:branch)}`
end)
But I'm waiting for a good solution that would instead, manage to invoke the right task from the SCM plugin

How is the phonecat tutorial git repository setup to allow learners to step through the tutorial

While going through the AngularJS phonecat tutorial (https://docs.angularjs.org/tutorial/step_00), I was very impressed the way the git repository is setup to allow the learner to checkout any particular step and look at diffs between that step and the previous/next step.
I started thinking about how the Git repository would be setup to achieve this.
Initially while creating the tutorial if each step was performed and checked-in and tagged then the repository would allow each step to be checkout and compared against other steps, easy. However, this quickly falls apart when you think the tutorial needs to be kept up-to-date without effecting the diffs between steps and also updating all the steps to use newer code or libraries.
Can some git ninja explain to me how they have achieved this. I see several branches and many check-ins to update to new version in their repo (https://github.com/angular/angular-phonecat). But the updates do not effect the learners view of the steps and the diffs between them. How?
I think the tutorial make use of tags to mark the commits in the project, you can type git tagand you will see a list of steps from step-0 to step-12.
you can make use of tags to mark your commits by using git tag [tag name] in your current working directory and the tag will point to your current commits.
Hope my explaination is clear enough that you can make use of it.
Btw The phonecat tutorial is really good.

CakePHP send emails daily

I am new to CakePHP and I am making an application where users fill out forms and then other users who are specified on the form have to add to the data. At the end of each day I want to send an email to all users who have been referenced on forms that day and tell them how many new forms they need to add information to.
I know how to run my query to figure out who I need to email and how to construct the email, but how do I make it happen once a day or at any set time? I have found something about cron jobs in my research but I don't fully understand or know if that will work for me. I am working in a Windows environment and launching my app on a heroku server currently.
Thanks for any info!
Cheers,
Jon
Although this question is not really related to CakePHP but rather to Heroku, I suggest you install that Heroku Scheduler Addon.
Once installed, you can write a shell script, such as follows:
#!/bin/sh
php -f path_to/your_php_file/which_sends_emails.php
and name it sendemailjob.sh or something. Make it executable by
sudo chmod +x sendemailjob.sh
After that, you just need to tell Heroku Scheduler to daily execute that file. Should not be too much magic.
Although I am not quite sure whether you actually have shell access since you're on Windows, maybe there is a different solution for Windows.

Resources