<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Slava Vasenin</title>
    <description>The latest articles on Forem by Slava Vasenin (@famevashere).</description>
    <link>https://forem.com/famevashere</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F253601%2F3a8848a6-7dfe-4e82-bef7-e7027855c0f4.png</url>
      <title>Forem: Slava Vasenin</title>
      <link>https://forem.com/famevashere</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/famevashere"/>
    <language>en</language>
    <item>
      <title>How to clean your git history</title>
      <dc:creator>Slava Vasenin</dc:creator>
      <pubDate>Mon, 16 Mar 2020 12:31:04 +0000</pubDate>
      <link>https://forem.com/visualcomposer/how-to-clean-your-git-history-32lg</link>
      <guid>https://forem.com/visualcomposer/how-to-clean-your-git-history-32lg</guid>
      <description>&lt;p&gt;Hi!&lt;br&gt;
I want to share you a short instruction on how to remove wrong or mistaken commits from a remote repository when you don't want to make a revert.&lt;/p&gt;

&lt;p&gt;Check changes and find what commits you want to remove.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;git log &lt;span class="nt"&gt;--stat&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Use the interactive rebase command.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;git rebase &lt;span class="nt"&gt;-i&lt;/span&gt; HEAD~X
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Put the number of commits instead of &lt;strong&gt;X&lt;/strong&gt; which you want to remove. Better to add a bit more to view the previous ones also. So, you need to remove 1 commit add number 3.&lt;/p&gt;

&lt;p&gt;You will see something like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pick a0b45b373 Dynamic field featured image url fixed
pick 8e8d27747 Update render condition for feedback popup component
pick 843770a32 Add dev.to version

# Rebase 680ac7c26..843770a32 onto 680ac7c26 (3 commands)
#
# Commands:
# p, pick &amp;lt;commit&amp;gt; = use commit
# r, reword &amp;lt;commit&amp;gt; = use commit, but edit the commit message
# e, edit &amp;lt;commit&amp;gt; = use commit, but stop for amending
# s, squash &amp;lt;commit&amp;gt; = use commit, but meld into previous commit
# f, fixup &amp;lt;commit&amp;gt; = like "squash", but discard this commit's log message
# x, exec &amp;lt;command&amp;gt; = run command (the rest of the line) using shell
# b, break = stop here (continue rebase later with 'git rebase --continue')
# d, drop &amp;lt;commit&amp;gt; = remove commit
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I use Vim as default text editor for Git.&lt;/p&gt;

&lt;p&gt;Replace the word &lt;code&gt;pick&lt;/code&gt; with the word &lt;code&gt;drop&lt;/code&gt; or &lt;code&gt;d&lt;/code&gt; for those commits that you want to remove. I remove only one, but I also checked and see that previous commits not related to my changes.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pick a0b45b373 Dynamic field featured image url fixed
pick 8e8d27747 Update render condition for feedback popup component
d 843770a32 Add dev.to version
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Save and exit from your editor.&lt;/p&gt;

&lt;p&gt;Check git status.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;git status
On branch master
Your branch is behind &lt;span class="s1"&gt;'origin/master'&lt;/span&gt; by 1 commit, and can be fast-forwarded.
  &lt;span class="o"&gt;(&lt;/span&gt;use &lt;span class="s2"&gt;"git pull"&lt;/span&gt; to update your &lt;span class="nb"&gt;local &lt;/span&gt;branch&lt;span class="o"&gt;)&lt;/span&gt;

nothing to commit, working tree clean
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In some cases, there can be merge conflicts after rebase. Follow instructions to solve them.&lt;/p&gt;

&lt;p&gt;The next step is to push it to your remote repository. You need to force this push because the remote repository will think that your current branch is behind.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git push &lt;span class="nt"&gt;-f&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Go and check your remote repository.&lt;/p&gt;

&lt;p&gt;That it. Thanks and Good luck 🚀&lt;/p&gt;

&lt;p&gt;Cover image by &lt;a href="https://www.flickr.com/photos/broccolini/5597043374"&gt;Diana Mounter&lt;/a&gt;&lt;/p&gt;

</description>
      <category>git</category>
      <category>github</category>
      <category>vim</category>
    </item>
    <item>
      <title>How to measure deployment frequency for WordPress plugin</title>
      <dc:creator>Slava Vasenin</dc:creator>
      <pubDate>Tue, 03 Mar 2020 15:02:40 +0000</pubDate>
      <link>https://forem.com/visualcomposer/how-to-measure-deployment-frequency-for-wordpress-plugin-1j5</link>
      <guid>https://forem.com/visualcomposer/how-to-measure-deployment-frequency-for-wordpress-plugin-1j5</guid>
      <description>&lt;p&gt;One year ago I read a very great book about DevOps science &lt;a href="https://www.goodreads.com/book/show/35747076-accelerate"&gt;"Accelerate"&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;There was a chapter about measurements that can be used to answer the question: Does your company has High-performance team in the development?&lt;/p&gt;

&lt;p&gt;These measurements:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Deployment Frequency&lt;/li&gt;
&lt;li&gt;Lead Time for changes&lt;/li&gt;
&lt;li&gt;MTTR&lt;/li&gt;
&lt;li&gt;Change Failure rate&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;One of the most interesting points is &lt;strong&gt;Deployment Frequency&lt;/strong&gt; and we had a long discussion about this in my team about that. The book says that the high-performance team should deliver on-demand, multiple deploys per day. &lt;/p&gt;

&lt;p&gt;The problem is that if we will publish one plugin every day multiple times in &lt;a href="https://wordpress.org/plugins/visualcomposer/"&gt;"WordPress.org"&lt;/a&gt; people won't like it because there are no automatic updates for Wordpress plugins in the admin dashboard.&lt;/p&gt;

&lt;p&gt;So, Publishing so frequently isn't an option, but the concept to have a deliverable product as often as the possible sound really useful. &lt;/p&gt;

&lt;p&gt;We use a &lt;a href="https://trunkbaseddevelopment.com/"&gt;trunk-based development&lt;/a&gt; branching model. What does it mean?&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;A source-control branching model, where developers collaborate on code in a single branch called ‘trunk’(master), resist any pressure to create other long-lived development branches by employing documented techniques. They, therefore, avoid merge hell, do not break the build, and live happily ever after.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;There is a master branch were we merge all pull requests. Is it safe? From point of continues integrations, we run tests pipeline for every commit and every merge. Sound safe! How true is it? Not sure. No one during the merge of the pull request thinks it can be delivered to the customer at once.&lt;/p&gt;

&lt;p&gt;The only thing left is to update the release brunch as frequently as possible. Here is our scenario:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Developer crates pull request. Before all CI pipeline's tests have been successfully completed. &lt;/li&gt;
&lt;li&gt;A reviewer checks code and confirms this pull request as valid.&lt;/li&gt;
&lt;li&gt;A reviewer merges pull request.&lt;/li&gt;
&lt;li&gt;Release engineer checks during the day the state of the master branch and if it has updates, decides are this code safe for the update in the current release branch.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;So every update counts as deployment. Makes sense, isn't it?&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;If you have any suggestions or you want to share what kind of practices you use in your company, please welcome to write comments :)&lt;/p&gt;

&lt;p&gt;Thanks and Good Luck 🚀&lt;/p&gt;

</description>
      <category>wordpress</category>
      <category>github</category>
      <category>codequality</category>
    </item>
    <item>
      <title>How to get WordPress plugin release in GitHub actions</title>
      <dc:creator>Slava Vasenin</dc:creator>
      <pubDate>Mon, 10 Feb 2020 15:18:16 +0000</pubDate>
      <link>https://forem.com/visualcomposer/how-to-get-wordpress-plugin-release-in-github-actions-4336</link>
      <guid>https://forem.com/visualcomposer/how-to-get-wordpress-plugin-release-in-github-actions-4336</guid>
      <description>&lt;p&gt;We started to use GitHub actions to build Visual Composer &lt;a href="https://github.com/VisualComposer/builder/releases"&gt;release&lt;/a&gt; candidates in GitHub. This action will prepare a proper zip archive file which we can use to update our plugin in Wordpress.org. &lt;/p&gt;

&lt;p&gt;We decided that the release will be built on the new tag. The tag will be the version of the published release.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;on&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;push&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;tags&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;*'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We already had the script which was able to create a valid zip archive of Visual Composer Website Builder for Wordpress.org. It looks like this.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;node _infrastructure/vcwb-builder/builder plugin &lt;span class="nt"&gt;-b&lt;/span&gt; VERSION &lt;span class="nt"&gt;-p&lt;/span&gt; ./_infrastructure
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Yeah, this script will set plugin version also &lt;code&gt;-b VERSION&lt;/code&gt;. The question is how to get the version from GitHub tag. There is access to &lt;code&gt;$GITHUB_REF&lt;/code&gt; where we can get tags. I decide to create variable &lt;code&gt;get_version&lt;/code&gt; which can be used in other steps of the job.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Get the version&lt;/span&gt;
  &lt;span class="na"&gt;id&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;get_version&lt;/span&gt;
  &lt;span class="na"&gt;run&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then we just need to use &lt;code&gt;steps.version_version&lt;/code&gt; in the next step.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Build project&lt;/span&gt;
  &lt;span class="na"&gt;run&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;|&lt;/span&gt;
    &lt;span class="s"&gt;yarn install&lt;/span&gt;
    &lt;span class="s"&gt;node _infrastructure/vcwb-builder/builder plugin -b ${{ steps.get_version.outputs.VERSION }} -p ./_infrastructure&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The next action is to create Github release itself.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Create Release&lt;/span&gt;
  &lt;span class="na"&gt;id&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;create_release&lt;/span&gt;
  &lt;span class="na"&gt;uses&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;actions/create-release@v1.0.0&lt;/span&gt;
  &lt;span class="na"&gt;env&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;GITHUB_TOKEN&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;${{ secrets.GITHUB_TOKEN }}&lt;/span&gt;
  &lt;span class="na"&gt;with&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;tag_name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;${{ github.ref }}&lt;/span&gt;
    &lt;span class="na"&gt;release_name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;${{ github.ref }}&lt;/span&gt;
    &lt;span class="na"&gt;draft&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;
    &lt;span class="na"&gt;prerelease&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After release creation needs to upload our zip archive. I use &lt;code&gt;actions/upload-release-asset@v1.0.1&lt;/code&gt; action for that.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Upload Release Asset&lt;/span&gt;
  &lt;span class="na"&gt;id&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;upload_release_asset&lt;/span&gt;
  &lt;span class="na"&gt;uses&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;actions/upload-release-asset@v1.0.1&lt;/span&gt;
  &lt;span class="na"&gt;env&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;GITHUB_TOKEN&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;${{ secrets.GITHUB_TOKEN }}&lt;/span&gt;
  &lt;span class="na"&gt;with&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;upload_url&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;${{ steps.create_release.outputs.upload_url }}&lt;/span&gt;
    &lt;span class="na"&gt;asset_path&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;./_infrastructure/visualcomposer.zip&lt;/span&gt;
    &lt;span class="na"&gt;asset_name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;visualcomposer.zip&lt;/span&gt;
    &lt;span class="na"&gt;asset_content_type&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;application/zip&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That's it. The full version of the configuration file you can check &lt;a href="https://github.com/VisualComposer/builder/blob/master/.github/workflows/create-dev-release.yml"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Good luck ✌️&lt;/p&gt;

</description>
      <category>github</category>
      <category>devops</category>
      <category>wordpress</category>
      <category>actions</category>
    </item>
  </channel>
</rss>
