Posts

Showing posts with the label Git

Gitlab: Local Continuous Integration with Docker & Dotnetcore

Started this in the beginning of the year...
   On a Friday night, I spent my time working up til 6 in the morning on this. Probably the most difficult but simple process I've completed. Still proud that I completed it in a single night despite all the challenges. Some of which actually helped me create a solution more professional in my opinion. Meaning I didn't just create a work around. For example in my research I found other developers using scp (secure copy in linux) with sshpass which isn't problem when deploying remotely. However I needed to do it locally. So for me using an ssh really seems waste for internal Processing. At the time creating this solution though I didn't care I need something fast. I should also note I'm not using docker to host my aspnetcore app but using the gitlab-runner in docker. 

Update to now
I've come a long way now to where creating task runners is a lot easier and I'm spinning them up specifically for each project need. Whe…

.NET Core Docker Image for SPA Applications

If your looking to get CI/CD up and running with a SPA Application I recommend this setup. This article is based on Aspnet Core 2.1 and up. If you read the docker docs on the 2.1 version of dotnet core you will see they removed nodejs, which breaks a bunch of stuff if your using dotnet core with either Angular2 or Reactjs. I currently use gitlab-runners but with the volumes config to publish my sites.

Notes from Dotnet
Using NodeJS in microsoft/aspnetcore-build, but this is missing from dotnet/core/sdk:2.1. What should I do?
You can either install NodeJS by adding a few lines of code to your Dockerfile that download and extract NodeJS, or you can use the multi-stage feature of Docker and the official NodeJS images. Sample code to install NodeJS on your own: # set up nodeENV NODE_VERSION 8.9.4 ENV NODE_DOWNLOAD_SHA 21fb4690e349f82d708ae766def01d7fec1b085ce1f5ab30d9bda8ee126ca8fc RUN curl -SL "https://nodejs.org/dist/v${NODE_VERSION}/node-v${NODE_VERSION}-linux-x64.tar.gz" --out…

Gitlab: Switching to Access Tokens with Your Repos

If you haven't yet switch to using Access Tokens for your repo clone. Enable your Two-Factor Authentication and create an access token under your profile. I've done this with my gitlab and keep forgetting the quick way to update the path/command.

Go to https:///YOURGITLAB.com/profile/two_factor_authThen go to https:///YOURGITLAB.com/profile/personal_access_tokens create a token with the api setting.Now switching your remote url for your git is simple. Using this command..
git remote set-url origin http://USER:TOKEN@YOURGITLAB.com/repo.git If you have multiple origin urls you might have to remove them and add back an origin upstream and reset the origin master as the default upstream. This doesn't normally happen but I had a unique case where I had multiple urls for the origin where I was pushing to multiple repos for the same code. This probably won't be your case but I figure I might add this bit in.

Git Cheatsheet

I'm always handling the code wherever I go so maybe its time I shared my notes. I'm really surprised but I should with my experience how many developers don't know git.
msysgit - git: 'credential-cache' is not a git commandHow do I update the password for Git?How do you attach a new pull request to an existing issue on github Squash commits!
I'm always forgetting this and its really simple to do if you remember both commands.

git rebase -i xxxxxxxxxxxxxxxx
git push --force origin master "where xxxxxxxxxx is the SHA of the commit upto which I've to squash"


Get username

git config user.nameChange Email
git config user.emailCaching Password on Windows.

git config --global credential.helper wincred

More coming soon...

Editing Blogger Post on Github, Rough Draft

Image
This was an idea that came to me when I was looking at haacked's blog (awesome blog by the way!) which is mostly built with jekyll site since he uses github to host his site. I'm not really a fan of jekyll, I won't lie never played around with it. If github hosted a web server in nodeJs I probably would just move my blog in a heartbeat over to github completely but for now I like having it on blogger. 
    Now I haven't implemented this but here is a rough idea what I would do to achieve it. I think the image is pretty detailed but to sum it up I would IFTTT to notify my application when a new post is available and then create a commit to github and allow people to fork the blog's repository and then create edits. I've even started the repo here... 

Research Blogger JSON API: Using the API - Blogger — Google Developers http://jekyllrb.com/docs/posts/ - If I ever need to move my blog to github it would be good to know. Comments | GitHub API - Could I tie in with …

Google App Engine Automating Code Pushes

I was working on this idea for Penguins Rising when Google App Engine was relatively new so this solution didn't come until later in my research. Either way it good to spread the word and get an understand with what I attempted.

Solution
Google Cloud Platform Blog: Using GitHub for Push-to-Deploy

Problems
I have yet to created a process that takes advantage of the continuous integration in penguins Rising since most of my code is built in javascript is would be nice to have a bridge between phantomjs and Travis CI. Not sure how it would work since Google app engine would the notice for code pushes at the same time when I check in and Travis would have to tell G.A.E that the code cleared.

Resources
https://gist.github.com/benbeadle/5185679
d6y/example-webhook
Uploading, Downloading, and Managing a Python App - Python
Python — Google Developers
Webhooks | GitHub API
Local Unit Testing for Python - Python - This showed the most promise.



Orchard: Filter out Content Types From Restricted Users.

I want to be very clear I did not write this code but it was provided to me and I was given permission by a colleague of mine to submit it.. To respect his privacy I will not be able to provide his name but on his behalf I did submit the code to help improve the orchard project. To explain it a little bit what the purpose of this code edit, it is to filter out content that is editable but the user does not have the permissions to create them. Normal what Orchard would do is display all creatable content and if a user clicks on a particular content type that is restricted it simply replies to the user that they do not have access to it. However with a lot of CMS projects I have developed it is sometimes better to simply hide what the user can not or should not be able to do. Less questions come up and even less problems are seen from the user's perspective. This is what I consider to be a best practice to provide the user with a good experience.

The Location:\orchard\src\Orchar…