@@ -6,11 +6,14 @@ package native
6
6
7
7
import (
8
8
"fmt"
9
+ "net/url"
9
10
"strings"
10
11
11
12
"github.com/go-vela/types/constants"
12
13
"github.com/go-vela/types/library"
13
14
"github.com/go-vela/types/yaml"
15
+
16
+ "github.com/sirupsen/logrus"
14
17
)
15
18
16
19
// EnvironmentStages injects environment variables
@@ -71,6 +74,14 @@ func (c *client) EnvironmentSteps(s yaml.StepSlice) (yaml.StepSlice, error) {
71
74
func environment (b * library.Build , r * library.Repo , u * library.User ) map [string ]string {
72
75
workspace := fmt .Sprintf ("/home/%s_%s_%d" , r .GetOrg (), r .GetName (), b .GetNumber ())
73
76
77
+ // TODO: (hack) consider making a metadata struct
78
+ // that gets populated in server and then passed
79
+ // from the server to the compiler.
80
+ uri , err := url .Parse (r .GetLink ())
81
+ if err != nil {
82
+ logrus .Errorf ("unable to parse link for repo %s" , r .GetFullName ())
83
+ }
84
+
74
85
env := map [string ]string {
75
86
// build specific environment variables
76
87
"BUILD_BRANCH" : b .GetBranch (),
@@ -97,14 +108,14 @@ func environment(b *library.Build, r *library.Repo, u *library.User) map[string]
97
108
"VELA_ADDR" : "TODO" ,
98
109
"VELA_CHANNEL" : "vela" ,
99
110
"VELA_DATABASE" : "postgres" ,
100
- "VELA_DISTRIBUTION" : "linux " ,
111
+ "VELA_DISTRIBUTION" : "TODO " ,
101
112
"VELA_HOST" : "TODO" ,
102
- "VELA_NETRC_MACHINE" : "github.com" ,
113
+ "VELA_NETRC_MACHINE" : uri . Host ,
103
114
"VELA_NETRC_PASSWORD" : u .GetToken (),
104
115
"VELA_NETRC_USERNAME" : "x-oauth-basic" ,
105
116
"VELA_QUEUE" : "redis" ,
106
- "VELA_RUNTIME" : "docker " ,
107
- "VELA_SOURCE" : "https ://github.com" ,
117
+ "VELA_RUNTIME" : "TODO " ,
118
+ "VELA_SOURCE" : fmt . Sprintf ( "%s ://%s" , uri . Scheme , uri . Host ) ,
108
119
"VELA_VERSION" : "TODO" ,
109
120
"VELA_WORKSPACE" : workspace ,
110
121
"CI" : "vela" ,
0 commit comments