Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
7fb79a3a
Commit
7fb79a3a
authored
Jun 01, 2015
by
Eric Tune
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #8693 from caesarxuchao/contrib/git-sync
Contrib/git sync
parents
3c067b76
28c1d7ac
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
59 additions
and
59 deletions
+59
-59
pod.yaml
contrib/git-sync/demo/config/pod.yaml
+43
-47
service.yaml
contrib/git-sync/demo/config/service.yaml
+9
-7
main.go
contrib/git-sync/main.go
+7
-5
No files found.
contrib/git-sync/demo/config/pod.yaml
View file @
7fb79a3a
id
:
blog-pod
apiVersion
:
v1beta3
kind
:
Pod
apiVersion
:
v1beta1
desiredState
:
manifest
:
version
:
v1beta1
containers
:
-
name
:
git-sync
image
:
proppy/git-sync
imagePullPolicy
:
PullAlways
env
:
-
name
:
GIT_SYNC_REPO
value
:
https://github.com/GoogleCloudPlatform/kubernetes.git
-
name
:
GIT_SYNC_DEST
value
:
/git
volumeMounts
:
-
name
:
markdown
mountPath
:
/git
-
name
:
hugo
image
:
proppy/hugo
imagePullPolicy
:
PullAlways
env
:
-
name
:
HUGO_SRC
value
:
/src/contrib/git-sync/demo/blog
-
name
:
HUGO_BUILD_DRAFT
value
:
'
true'
-
name
:
HUGO_BASE_URL
value
:
example.com
volumeMounts
:
-
name
:
markdown
mountPath
:
/src
-
name
:
html
mountPath
:
/dest
-
name
:
nginx
image
:
nginx
volumeMounts
:
-
name
:
html
mountPath
:
/usr/share/nginx/html
ports
:
-
name
:
http-server
containerPort
:
80
volumes
:
metadata
:
labels
:
name
:
blog
name
:
blog-pod
spec
:
containers
:
-
name
:
git-sync
image
:
gcr.io/google_containers/git-sync
imagePullPolicy
:
Always
volumeMounts
:
-
name
:
markdown
source
:
emptyDir
:
{}
mountPath
:
/git
env
:
-
name
:
GIT_SYNC_REPO
value
:
https://github.com/GoogleCloudPlatform/kubernetes.git
-
name
:
GIT_SYNC_DEST
value
:
/git
-
name
:
hugo
image
:
gcr.io/google_containers/hugo
imagePullPolicy
:
Always
volumeMounts
:
-
name
:
markdown
mountPath
:
/src
-
name
:
html
mountPath
:
/dest
env
:
-
name
:
HUGO_SRC
value
:
/src/contrib/git-sync/demo/blog
-
name
:
HUGO_BUILD_DRAFT
value
:
"
true"
-
name
:
HUGO_BASE_URL
value
:
example.com
-
name
:
nginx
image
:
nginx
volumeMounts
:
-
name
:
html
source
:
emptyDir
:
{}
labels
:
name
:
blog
mountPath
:
/usr/share/nginx/html
ports
:
-
containerPort
:
80
volumes
:
-
name
:
markdown
emptyDir
:
{}
-
name
:
html
emptyDir
:
{}
contrib/git-sync/demo/config/service.yaml
View file @
7fb79a3a
id
:
blog-service
apiVersion
:
v1beta3
kind
:
Service
apiVersion
:
v1beta1
port
:
80
containerPort
:
80
selector
:
name
:
blog
createExternalLoadBalancer
:
true
metadata
:
name
:
blog-service
spec
:
createExternalLoadBalancer
:
true
ports
:
-
port
:
80
selector
:
name
:
blog
contrib/git-sync/main.go
View file @
7fb79a3a
...
...
@@ -66,12 +66,14 @@ func main() {
if
_
,
err
:=
exec
.
LookPath
(
"git"
);
err
!=
nil
{
log
.
Fatalf
(
"required git executable not found: %v"
,
err
)
}
if
err
:=
syncRepo
(
*
flRepo
,
*
flDest
,
*
flBranch
,
*
flRev
);
err
!=
nil
{
log
.
Fatalf
(
"error syncing repo: %v"
,
err
)
for
{
if
err
:=
syncRepo
(
*
flRepo
,
*
flDest
,
*
flBranch
,
*
flRev
);
err
!=
nil
{
log
.
Fatalf
(
"error syncing repo: %v"
,
err
)
}
log
.
Printf
(
"wait %d seconds"
,
*
flWait
)
time
.
Sleep
(
time
.
Duration
(
*
flWait
)
*
time
.
Second
)
log
.
Println
(
"done"
)
}
log
.
Printf
(
"wait %d seconds"
,
*
flWait
)
time
.
Sleep
(
time
.
Duration
(
*
flWait
)
*
time
.
Second
)
log
.
Println
(
"done"
)
}
// syncRepo syncs the branch of a given repository to the destination at the given rev.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment