Skip to content

Commit f0571c5

Browse files
plopoyopLagoja
andauthored
Add git plugin (#2735)
## Summary Implement Git plugin support for loading plugins from any Git repository with revision/branch/directory targeting. Extends existing GitHub plugin functionality to support self-hosted and local Git repositories. Fix #2048 in a more simple way than #2470 since there is no change in json schema ## How was it tested? Manually on a mock project with multiple transport : git+ssh, git+http, git+file ## Community Contribution License All community contributions in this pull request are licensed to the project maintainers under the terms of the [Apache 2 License](https://www.apache.org/licenses/LICENSE-2.0). By creating this pull request, I represent that I have the right to license the contributions to the project maintainers under the Apache 2 License as stated in the [Community Contribution License](https://github.com/jetify-com/opensource/blob/main/CONTRIBUTING.md#community-contribution-license). --------- Co-authored-by: John Lago <750845+Lagoja@users.noreply.github.com>
1 parent 0b9e37d commit f0571c5

File tree

17 files changed

+689
-0
lines changed

17 files changed

+689
-0
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
some data
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"packages": [],
3+
"shell": {
4+
"init_hook": [
5+
"echo 'Welcome to devbox!' > /dev/null"
6+
]
7+
},
8+
"include": [
9+
"git+https://github.com/jetify-com/devbox-plugin-example.git?rev=d9c00334353c9b1294c7bd5dbea128c149b2eb3a"
10+
]
11+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"lockfile_version": "1",
3+
"packages": {}
4+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/bash
2+
3+
expected="I AM SET"
4+
if [ "$MY_ENV_VAR" == "$expected" ]; then
5+
echo "Success! MY_ENV_VAR is set to '$MY_ENV_VAR'"
6+
else
7+
echo "MY_ENV_VAR environment variable is not set to '$expected'"
8+
exit 1
9+
fi
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
some data
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
some data

examples/plugins/git/devbox.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"packages": [],
3+
"shell": {
4+
"init_hook": [
5+
"echo 'Welcome to devbox!' > /dev/null"
6+
]
7+
},
8+
"include": [
9+
"git+https://github.com/jetify-com/devbox-plugin-example.git",
10+
"git+https://github.com/jetify-com/devbox-plugin-example.git?dir=custom-dir",
11+
"git+https://github.com/jetify-com/devbox-plugin-example.git?ref=test/branch"
12+
]
13+
}

examples/plugins/git/devbox.lock

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"lockfile_version": "1",
3+
"packages": {}
4+
}

examples/plugins/git/test.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/bash
2+
3+
expected="I AM SET (new value)"
4+
custom_expected="I AM SET TO CUSTOM (new value)"
5+
if [ "$MY_ENV_VAR" == "$expected" ] && [ "$MY_ENV_VAR_CUSTOM" == "$custom_expected" ]; then
6+
echo "Success! MY_ENV_VAR is set to '$MY_ENV_VAR'"
7+
echo "Success! MY_ENV_VAR_CUSTOM is set to '$MY_ENV_VAR_CUSTOM'"
8+
else
9+
echo "ERROR: MY_ENV_VAR environment variable is not set to '$expected' OR MY_ENV_VAR_CUSTOM variable is not set to '$custom_expected'"
10+
exit 1
11+
fi
12+
13+
echo BRANCH_ENV_VAR=$BRANCH_ENV_VAR
14+
if [ "$BRANCH_ENV_VAR" != "I AM A BRANCH VAR" ]; then exit 1; fi;
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
some data

0 commit comments

Comments
 (0)