Access to GitHub Deployments Dashboard - github

Good morning!
I have been playing around with GitHub Actions to build and deploy to multiple stages. Works like a charm.
But deployments in GitHub has been hard to overview.
I have access to Environments, which is where I’ve added some secrets.
I found this article in the docs, but I can’t find it in my public repo. https://docs.github.com/en/github/administering-a-repository/viewing-deployment-activity-for-your-repository#viewing-the-deployments-dashboard
Does anyone know how GigHub deployments work and how to start using it?

"Github Deployments" is really just an API you can use to alert Github about deployments (start/finish) and the Deployments Dashboard to view activity. In order for anything to show up there you first need to actually trigger a Github deployment event and specify an environment. Put the action I've linked below at the start and then end of your existing deployment automation in Github Actions and you should start seeing something show up.
Deployment Action
https://github.com/bobheadxi/deployments
You should probably give this a read through as well, goes into details on where the Github Deployments API fits into things.
https://docs.github.com/en/rest/reference/repos#deployments

Related

How to start/trigger a job when a new version of deployment is released (image updated) on Kubernetes?

I have two environments (clusters): Production and Staging with two independent databases. They are both deployed on Kubernetes and production doesn't have a fixed schedule for new deployments but it happens on a weekly basis (roughly).
I would like to sync the production database with the staging database every time that a new release is deployed to production (kubernetes deployment is updated with new image).
Is there a way that I can set a job/cronjob to be triggered everytime this even happen?
The deployments are done using ArgoCD to pull the changes in the deployment manifest from a github repository.
I don't think this functionality is inherent to kubernetes; you are asking about something custom that can be implemented in a variety of ways (depending on your tool stack)
e.g.
if you are using helm to install to Production, you can use a post-install hook that triggers a Job that does what you want.
Perhaps ArgoCD has some post-install functionality that can also create a Job resource doing what you want.
I think you can also use a tool like Kyverno and write a policy to generate a K8s job upon any resource created in K8s.
This is exactly the case what Argo Events is for.
https://argoproj.github.io/argo-events/
There are many ways to implement this, but it depends on your exact situation how it’s best for you.
Eg. if you can use a Git tag event’s webhook you could go with an HTTP trigger to initiate a Job or Argo Workflow.

Setting up Review Apps in Spinnaker

I was wondering if there is any way to configure review apps in Spinnaker like Heroku or Gitlab have? Looked through documentation and forums and couldn't find anything. Just verifying.
You can trigger spinnaker pipeline using merge request event from GitLaband deploy your app under review to separeate namespace.
The main task is to implement correct lifecycle and clear obsolate applications using Spinnaker pipelines. But it is possible with current Spinnaker's functionality.

Identifying work items which have been released via VSTS API

Trying to determine which VSTS Work Items have been released to a given Environment (production). Ideally looking for a Service Hook to tell me when work items are deployed so we can keep the rest of the company updated on when items are deployed.
Cannot find this available in the VSTS API.
In the VSTS UI under the Release Summary tab it shows linked Work Items. However linked Work Items don't appear to be available via the API.
VSTS API docs for Get Release
In the VSTS UI under each Work Item, it shows when it was integrated into a build, however not when that build has been released.
Any ideas?
There's a REST API, you're just looking in the wrong place for it. BTW, you can find this stuff easily by looking at the network traffic in the F12 tools in your browser.
https://<accountUrl>/<Project>/_apis/Release/releases/<ReleaseID>/workitems?baseReleaseId=<ReleaseToCompareAgainst>&%24top=250
For your question:
Ideally looking for a Service Hook to tell me when work items are
deployed so we can keep the rest of the company updated on when items
are deployed.
The deployed work items information is already included in the Release Deployment Service Hooks as below:
So you just need to create a Service Hook for Release deployment completed event and create a web service to listen on this.

How should I manage deployments with kubernetes

I am hoping to find a good way to automate the process of going from code to a deployed application on my kubernetes cluster.
In order to build and deploy my app I need to first build the docker image, tag it, and then push it to ECR. I then need to update my deployment.yaml with the new tag for the docker image and run the deployment with kubectl apply -f deployment.yaml.
This will go and perform a rolling deployment on the kubernetes cluster updating the pods to the new version of the container image, once this deployment has completed I may need to do other application specific things such as running database migrations, or cache clear/warming which may or may not need to run for a given deployment.
I suppose I could just write a shell script that runs all of these commands, and run it whenever I want to start up a new deployment, but I am hoping there is a better/industry standard way to solve these problems that I have missed.
As I was writing this question I noticed stackoverflow recommend this question: Kubernetes Deployments. One of the answers to it seems to imply at least some of what I am looking for is coming soon to kubernetes, but I want to make sure that if there is a better solution I could be using now that I at least know about it.
My colleague has a good blog post about this topic:
http://blog.jonparrott.com/building-a-paas-on-kubernetes/
Basically, Kubernetes is not a Platform-as-a-Service, it's a toolkit on which you can build your own Platform-a-as-Service. It's not very opinionated by design, instead it focuses on solving some tricky problems with scheduling, networking, and coordinating containers, and lets you layer in your opinions on top of it.
One of the simplest ways to automate the workflows you're describing is using a Makefile.
A step up from that, you can design your own miniature PaaS, which the author of the first blog post did here:
https://github.com/jonparrott/noel
Or, you could get involved in more sophisticated efforts to build an open source PaaS on Kubernetes, like OpenShift:
https://www.openshift.com/
or Deis, which is building a Heroku-like platform on Kubernetes:
https://deis.com/
or Redspread, which is building "Git for Kubernetes cluster":
https://redspread.com/
and there are many other examples of people building PaaS on top of Kubernetes. But I think it will be a long time, if ever, that there is an "industry standard" way to deploy to Kubernetes, since half the purpose is to enable multiple deployment workflows for different use cases.
I do want to note that as far as building container images, Google Cloud Container Builder can be a useful tool, since you can do things like use it to automatically build an image any time you push to a repository which could then get deployed. Alternatively, Jenkins is a popular way to automate CI/CD flows with Kubernetes.
I suppose I could just write a shell script that runs all of these commands, and run it whenever I want to start up a new deployment, but I am hoping there is a better/industry standard way to solve these problems that I have missed.
The company I work for (Weaveworks) and other folks in the space had been advocating for an approach that we call GitOps, please take a look at our series of blog posts covering the topic:
GitOps - Operations by Pull Request
The GitOps Pipeline - Part 2
GitOps Part 3 - Observability
Storing Secure Sealed Secrets using GitOps
The gist of it is that you push images from CI, your checked YAML manifests in git (usually different repo from app code). This repo with manifests is then applied to each of your clusters (dev/prod) by a reconciliation operator. You can automate it all yourself quite easily, but also do take a look at what we have built.
Disclaimer: I am a Kubernetes contributor and Weaveworks employee. We build open-source and commercial tools that help people to get to production with Kubernetes sooner.
We're working on an open source project called Jenkins X which is a proposed sub project of the Jenkins foundation aimed at automating CI/CD on Kubernetes using Jenkins and GitOps for promotion.
When you merge a change to the master branch, Jenkins X creates a new semantically versioned distribution of your app (pom.xml, jar, docker image, helm chart). The pipeline then automates the generation of Pull Requests to promote your application through all of the Environments via GitOps.
Here's a demo of how to automate CI/CD with multiple environments on Kubernetes using GitOps for promotion between environments and Preview Environments on Pull Requests - using Spring Boot and nodejs apps (but we support many languages + frameworks).

GitLab and it's webhook for Build events

I've set up my own GitLab CE server with CI in it. I can already create a webhook to deploy my code to a server just by pushing it. (Many thanks to Matt Jones and his little invention).
However, I still have one issue there. I don't really find a very good description about GitlAbs new feature about Webhook for Build Events. I think I'll need this, since I wish to deploy my code ONLY AFTER a build was succesfull. If I set the webhook for push event, then it has no problem, inmediatly deploys the code. Can any of you provide me with a proper instruction, what do I have to make, to achieve my goal?
Thanks a lot in advance!
I use jenkins for these purposes, you can also set your preferences about when to deploy your code and run pre and post build steps. It's really useful and it has Gitlab integration with the Web hooks.