Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
packer
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kristopher Ruzic
packer
Commits
45dfcf59
Commit
45dfcf59
authored
Jul 08, 2013
by
Mitchell Hashimoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
scripts: Add git commit to builds
parent
d52c43ed
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
3 deletions
+25
-3
packer.go
packer.go
+3
-1
packer/version.go
packer/version.go
+8
-0
scripts/build.sh
scripts/build.sh
+14
-2
No files found.
packer.go
View file @
45dfcf59
...
@@ -27,7 +27,9 @@ func main() {
...
@@ -27,7 +27,9 @@ func main() {
runtime
.
GOMAXPROCS
(
runtime
.
NumCPU
())
runtime
.
GOMAXPROCS
(
runtime
.
NumCPU
())
}
}
log
.
Printf
(
"Packer Version: %s %s"
,
packer
.
Version
,
packer
.
VersionPrerelease
)
log
.
Printf
(
"Packer Version: %s %s %s"
,
packer
.
Version
,
packer
.
VersionPrerelease
,
packer
.
GitCommit
)
log
.
Printf
(
"Packer Target OS/Arch: %s %s"
,
runtime
.
GOOS
,
runtime
.
GOARCH
)
log
.
Printf
(
"Packer Target OS/Arch: %s %s"
,
runtime
.
GOOS
,
runtime
.
GOARCH
)
config
,
err
:=
loadConfig
()
config
,
err
:=
loadConfig
()
...
...
packer/version.go
View file @
45dfcf59
...
@@ -5,6 +5,10 @@ import (
...
@@ -5,6 +5,10 @@ import (
"fmt"
"fmt"
)
)
// The git commit that is being compiled. This will be filled in by the
// compiler for source builds.
var
GitCommit
string
// The version of packer.
// The version of packer.
const
Version
=
"0.1.6"
const
Version
=
"0.1.6"
...
@@ -29,6 +33,10 @@ func (versionCommand) Run(env Environment, args []string) int {
...
@@ -29,6 +33,10 @@ func (versionCommand) Run(env Environment, args []string) int {
fmt
.
Fprintf
(
&
versionString
,
".%s"
,
VersionPrerelease
)
fmt
.
Fprintf
(
&
versionString
,
".%s"
,
VersionPrerelease
)
}
}
if
GitCommit
!=
""
{
fmt
.
Fprintf
(
&
versionString
,
" (%s)"
,
GitCommit
)
}
env
.
Ui
()
.
Say
(
versionString
.
String
())
env
.
Ui
()
.
Say
(
versionString
.
String
())
return
0
return
0
}
}
...
...
scripts/build.sh
View file @
45dfcf59
#!/bin/bash
#!/bin/bash
#
# This script only builds the application from source.
set
-e
set
-e
NO_COLOR
=
"
\x
1b[0m"
NO_COLOR
=
"
\x
1b[0m"
...
@@ -14,13 +16,23 @@ DIR="$( cd -P "$( dirname "$SOURCE" )/.." && pwd )"
...
@@ -14,13 +16,23 @@ DIR="$( cd -P "$( dirname "$SOURCE" )/.." && pwd )"
# Change into that directory
# Change into that directory
cd
$DIR
cd
$DIR
# Get the git commit
GIT_COMMIT
=
$(
git rev-parse
--short
HEAD
)
GIT_DIRTY
=
$(
test
-n
"
`
git status
--porcelain
`
"
&&
echo
"+CHANGES"
)
# Compile the main Packer app
# Compile the main Packer app
echo
-e
"
${
OK_COLOR
}
--> Compiling Packer
${
NO_COLOR
}
"
echo
-e
"
${
OK_COLOR
}
--> Compiling Packer
${
NO_COLOR
}
"
go build
-v
-o
bin/packer
.
go build
\
-ldflags
"-X github.com/mitchellh/packer/packer.GitCommit
${
GIT_COMMIT
}${
GIT_DIRTY
}
"
\
-v
\
-o
bin/packer
.
# Go over each plugin and build it
# Go over each plugin and build it
for
PLUGIN
in
$(
find ./plugin
-mindepth
1
-maxdepth
1
-type
d
)
;
do
for
PLUGIN
in
$(
find ./plugin
-mindepth
1
-maxdepth
1
-type
d
)
;
do
PLUGIN_NAME
=
$(
basename
${
PLUGIN
}
)
PLUGIN_NAME
=
$(
basename
${
PLUGIN
}
)
echo
-e
"
${
OK_COLOR
}
--> Compiling Plugin:
${
PLUGIN_NAME
}${
NO_COLOR
}
"
echo
-e
"
${
OK_COLOR
}
--> Compiling Plugin:
${
PLUGIN_NAME
}${
NO_COLOR
}
"
go build
-v
-o
bin/packer-
${
PLUGIN_NAME
}
${
PLUGIN
}
go build
\
-ldflags
"-X github.com/mitchellh/packer/packer.GitCommit
${
GIT_COMMIT
}${
GIT_DIRTY
}
"
\
-v
\
-o
bin/packer-
${
PLUGIN_NAME
}
${
PLUGIN
}
done
done
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