Skip to content
This repository was archived by the owner on Oct 23, 2024. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
efc07a8
Init: add Dispatchfile marker
jianhuabi Mar 19, 2020
ee301dd
Merge pull request #1 from jianhuabi/feature-1
jianhuabi Mar 19, 2020
849d5de
Feature-1: add cloud native output
jianhuabi Mar 19, 2020
931f8eb
feature-2: Bug fix a typo on github repo
jianhuabi Mar 19, 2020
70d97b1
Update docker registry
jianhuabi Mar 19, 2020
dba2987
Merge pull request #2 from jianhuabi/feature-2
jianhuabi Mar 19, 2020
0c356cd
CICD: add Dispatchfile ci pipeline
jianhuabi Mar 20, 2020
be6b4f1
Merge branch 'master' of github.com:jianhuabi/cicd-hello-world into f…
jianhuabi Mar 20, 2020
066e901
Merge pull request #3 from jianhuabi/feature-2
jianhuabi Mar 20, 2020
f7b9bfb
fixed bug deployment
jianhuabi Mar 20, 2020
c21a7ce
Merge branch 'master' into feature-3
jianhuabi Mar 20, 2020
75e2859
Merge pull request #4 from jianhuabi/feature-3
jianhuabi Mar 20, 2020
8bdde40
At deployment marker for feature-1
jianhuabi Mar 26, 2020
c738cc5
Merge pull request #5 from jianhuabi/feature-1
jianhuabi Mar 26, 2020
afed1d4
fixed bug deployment
jianhuabi Mar 31, 2020
1f19270
Merge pull request #6 from jianhuabi/feature-1
jianhuabi Mar 31, 2020
9e6d076
Update main.go
jianhuabi Mar 31, 2020
b83dbe3
Merge pull request #7 from jianhuabi/feature-5
jianhuabi Mar 31, 2020
e68d4b9
fixed bug deployment
jianhuabi Apr 10, 2020
ac4c494
Merge pull request #8 from jianhuabi/feature-6
jianhuabi Apr 10, 2020
9e5ac3a
add feature-1
jianhuabi May 27, 2020
bcfe73b
add feature-1
jianhuabi May 27, 2020
3a450d5
add feature-1
jianhuabi May 27, 2020
9ab2982
Update main.go
GavinBF Jul 26, 2020
96948f2
Update main.go
GavinBF Jul 26, 2020
e5c6d88
Merge pull request #1 from GavinBF/feature-6
GavinBF Jul 26, 2020
ea04c6e
Update main.go
GavinBF Jul 26, 2020
d72bcc5
Update main.go
GavinBF Jul 26, 2020
8bbdfec
Merge branch 'master' into feature-1
GavinBF Jul 26, 2020
ba3ffea
Merge pull request #2 from GavinBF/feature-1
GavinBF Jul 26, 2020
3d9ca97
Update Dispatchfile
GavinBF Jul 26, 2020
3aee326
Update Dispatchfile
GavinBF Jul 26, 2020
7b84a9a
Update main.go
GavinBF Jul 26, 2020
254d6b9
Merge pull request #3 from GavinBF/feature-1
GavinBF Jul 26, 2020
0405908
Update main.go
GavinBF Jul 27, 2020
1fb9031
Merge pull request #4 from GavinBF/feature-1
GavinBF Jul 27, 2020
2af1963
Update main.go
GavinBF Jul 27, 2020
5118601
Merge pull request #5 from GavinBF/feature-1
GavinBF Jul 27, 2020
bfd68b9
Update main.go
GavinBF Sep 7, 2020
afc8a2e
Merge branch 'master' into feature-6
GavinBF Sep 7, 2020
06a8af8
Merge pull request #6 from GavinBF/feature-6
GavinBF Sep 7, 2020
0999504
Update main.go
GavinBF Sep 7, 2020
048c56f
Merge pull request #7 from GavinBF/feature-6
GavinBF Sep 7, 2020
c47f325
Update main.go
GavinBF Sep 7, 2020
cd03be0
Update main.go
GavinBF Sep 7, 2020
c4bc4c1
Merge branch 'master' into feature-1
GavinBF Sep 7, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
84 changes: 84 additions & 0 deletions Dispatchfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
resource "src-git": {
type: "git"
param url: "$(context.git.url)"
param revision: "$(context.git.commit)"
}

resource "docker-image": {
type: "image"
param url: "gavinwang/hello-world:$(context.build.name)"
param digest: "$(inputs.resources.docker-image.digest)"
}

resource "gitops-git": {
type: "git"
param url: "https://github.com/GavinBF/cicd-hello-world-gitops"
}

task "test": {
inputs: ["src-git"]

steps: [
{
name: "test"
image: "golang:1.13.0-buster"
command: [ "go", "test", "./..." ]
workingDir: "/workspace/src-git"
}
]
}

task "build": {
inputs: ["src-git"]
outputs: ["docker-image"]
deps: ["test"]

steps: [
{
name: "build-and-push"
image: "chhsiao/kaniko-executor"
args: [
"--destination=$(outputs.resources.docker-image.url)",
"--context=/workspace/src-git",
"--oci-layout-path=/workspace/output/docker-image",
"--dockerfile=/workspace/src-git/Dockerfile"
]
}
]
}

task "deploy": {
inputs: ["docker-image", "gitops-git"]
steps: [
{
name: "update-gitops-repo"
image: "mesosphere/update-gitops-repo:v1.0"
workingDir: "/workspace/gitops-git"
args: [
"-git-revision=$(context.git.commit)",
"-substitute=imageName=gavinwang/hello-world@$(inputs.resources.docker-image.digest)"
]
}
]
}

actions: [
{
tasks: ["build", "deploy"]
on push: {
branches: ["master"]
}
},
{
tasks: ["build"]
on pull_request: {
chatops: ["build"]
}
},
{
tasks: ["build"]
on tag: {
names: ["*"]
}
}
]
8 changes: 6 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,14 @@ func main() {
// hello responds to the request with a plain-text "Hello, world" message.
func hello(w http.ResponseWriter, r *http.Request) {
log.Printf("Serving request: %s", r.URL.Path)
fmt.Fprintf(w, "Hello, world!\n")
fmt.Fprintf(w, "Hello, Gavin666 \n")
fmt.Fprintf(w, "Version: %s\n", Version)
fmt.Fprintf(w, "Build time: %s\n", Buildtime)
fmt.Fprintf(w, "D2iQ CI/CD!\n")
fmt.Fprintf(w, "Hello, Gavin test \n")
fmt.Fprintf(w, "Version: %s\n", Version)
fmt.Fprintf(w, "Build time: %s\n", Buildtime)
fmt.Fprintf(w, "D2iQ CI/CD! deployments At 9 6 2020, Done\n")
fmt.Fprintf(w, "D2iQ CI/CD!!!!!! deployments At 9 7 2020, Done\n")
}

// [END all]