-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fb01e45
commit ff29ee9
Showing
3 changed files
with
46 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
FROM alpine/git | ||
|
||
COPY clone.sh /usr/local/bin/ | ||
RUN chmod +x /usr/local/bin/clone.sh | ||
|
||
ENTRYPOINT [ "/usr/local/bin/clone.sh" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,27 @@ | ||
# git-plugin | ||
A custom git plugin to clone a repository and prints the last commit. | ||
A custom git plugin to clone a public git repository and prints the last commit. | ||
|
||
# Running it as part of CIE pipeline | ||
```console | ||
- step: | ||
identifier: clone | ||
name: clone | ||
type: Plugin | ||
spec: | ||
image: "shubham149/git-plugin" | ||
settings: | ||
path: codebase | ||
repo_url: https://github.com/shubham149/git-plugin.git | ||
branch: main | ||
``` | ||
|
||
# Run it locally | ||
This clones a git repo inside codebase folder. | ||
|
||
```console | ||
docker run --rm \ | ||
-e PLUGIN_PATH=codebase \ | ||
-e PLUGIN_REPO_URL=https://github.com/shubham149/git-plugin.git \ | ||
-e PLUGIN_BRANCH=main \ | ||
shubham149/git-plugin | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/bin/sh | ||
set -xe | ||
|
||
# If path setting is not set, then use current directory | ||
path=${PLUGIN_PATH:-.} | ||
mkdir -p ${path} | ||
cd ${path} | ||
|
||
# Clones the public git repo and checkout to a branch | ||
git clone ${PLUGIN_REPO_URL} . | ||
git checkout ${PLUGIN_BRANCH} | ||
|
||
# Prints the last commit | ||
git log -1 --stat |