Skip to content

Instantly share code, notes, and snippets.

View colinbut's full-sized avatar
🎯
Focusing

Colin But colinbut

🎯
Focusing
View GitHub Profile
# Hello there 👋, I'm Colin But
### Software/DevOps/Cloud Engineer
- 🔭 I’m currently working on: __DevOps & Site Reliability Engineering__
- 🌱 I’m currently learning: __Blockchain, Solidity Programming, Go__
- 💬 Ask me about __DevOps, SRE, Cloud Engineering (AWS), IAC, CI/CD, Docker, Kubernetes, Software Dev...__
- 🧧 Chinese name: __畢少謙__
- ⚡ Fun fact: Having grew up in Scotland, I've never tasted Haggis
NAME VERSION TYPE
HdrHistogram 2.1.12 java-archive
LatencyUtils 2.0.3 java-archive
US_export_policy java-archive
alpine-baselayout 3.1.0-r3 apk
alpine-keys 2.1-r1 apk
alsa-lib 1.1.8-r0 apk
apk-tools 2.10.3-r1 apk
app 0.0.1-SNAPSHOT java-archive
busybox 1.29.3-r10 apk
stage("Generate Software Bill of Materials (sbom) with Syft"){
steps{
sh '''
curl -sSfL https://raw.githubusercontent.com/anchore/syft/main/install.sh | sh -s -- -b /usr/local/bin
syft app:${BUILD_NUMBER} --scope all-layers -o json > sbom-${BUILD_NUMBER}.json
syft app:${BUILD_NUMBER} --scope all-layers -o table > sbom-${BUILD_NUMBER}.txt
'''
}
}
pipeline{
agent any
stages{
stage("Build Jar"){
steps{
sh 'cd syft-grype && ./mvnw clean install -Dcheckstyle.skip=true -Dmaven.test.skip=true'
}
}
stage("Build Container"){
steps{
terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 3.27"
}
}
required_version = ">= 0.14.9"
}
#!/bin/bash
yum update -y
# install docker
amazon-linux-extras install -y docker
service docker start
chkconfig docker on
usermod -a -G docker ec2-user
# install git
terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 3.27"
}
}
required_version = ">= 0.14.9"
}
---
name: Build
on:
push:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
Runs through a typical java app build pipeline that the app gets packaged up in a Docker container.
This global variable represents an opinionated build workflow for a Java Docker App.
i.e. goes through basic maven build lifecycle then does a docker image build then pushes it onto Docker Registry.
Full Steps:
<ul>
<li>Compile</li>
<li>Unit Test</li>
<li>Integration Test</li>
<li>Static Code Analysis using SonarQube</li>
import com.homeaway.devtools.jenkins.testing.JenkinsPipelineSpecification
import com.mycompany.colinbut.Git
class BuildJavaAppSpec extends JenkinsPipelineSpecification {
def buildJavaApp = null
def setup() {
buildJavaApp = loadPipelineScriptForTest("vars/buildJavaApp.groovy")
}