app-container: rename _ to - in validator

This commit is contained in:
Brandon Philips
2014-11-30 20:18:08 -05:00
parent e029b83c5e
commit 915af3346a
7 changed files with 24 additions and 69 deletions
+6 -6
View File
@@ -30,7 +30,7 @@ Keep in mind while running through the examples that rkt needs to be ran as root
Rocket uses content addressable storage (CAS) for storing an ACI on disk. In this example, the image is downloaded and added to the CAS.
```
$ rkt fetch https://storage-download.googleapis.com/users.developer.core-os.net/philips/validator/ace_validator_main.tar.gz
$ rkt fetch https://storage-download.googleapis.com/users.developer.core-os.net/philips/validator/ace-validator-main.tar.gz
sha256-f59cb373728bd0f73674cc0b50286e56ba15bdd15a9e4ce8ccca18d0b6034ce8
```
@@ -47,11 +47,11 @@ $ find /var/lib/rkt/cas/object/
Per the App Container [spec][spec] the sha256 is of the tarball, which is reproducable with other tools:
```
$ wget https://storage-download.googleapis.com/users.developer.core-os.net/philips/validator/ace_validator_main.tar.gz
$ wget https://storage-download.googleapis.com/users.developer.core-os.net/philips/validator/ace-validator-main.tar.gz
...
$ gunzip ace_validator_main.tar.gz
$ sha256sum ace_validator_main.tar
f59cb373728bd0f73674cc0b50286e56ba15bdd15a9e4ce8ccca18d0b6034ce8 ace_validator_main.tar
$ gunzip ace-validator-main.tar.gz
$ sha256sum ace-validator-main.tar
f59cb373728bd0f73674cc0b50286e56ba15bdd15a9e4ce8ccca18d0b6034ce8 ace-validator-main.tar
```
### Launching an ACI
@@ -59,7 +59,7 @@ f59cb373728bd0f73674cc0b50286e56ba15bdd15a9e4ce8ccca18d0b6034ce8 ace_validator_
To run an ACI, you can either use the sha256 hash, or the URL which you downloaded it from:
```
$ rkt run https://storage-download.googleapis.com/users.developer.core-os.net/philips/validator/ace_validator_main.tar.gz
$ rkt run https://storage-download.googleapis.com/users.developer.core-os.net/philips/validator/ace-validator-main.tar.gz
```
rkt will do the appropriate etag checking on the URL to make sure it has the most up to date version of the image.
+2 -2
View File
@@ -259,8 +259,8 @@ Then inspect the HTML returned for meta tags that have the following format:
Some examples for different schemes and URLs:
```
<meta name="ac-discovery" content="example.com https://storage.example.com/{os}/{arch}/{name}.{ext}?torrent">
<meta name="ac-discovery" content="example.com hdfs://storage.example.com/{name}-{os}-{arch}.{ext}">
<meta name="ac-discovery" content="example.com https://storage.example.com/{os}/{arch}/{name}-{version}.{ext}?torrent">
<meta name="ac-discovery" content="example.com hdfs://storage.example.com/{name}-{version}-{os}-{arch}.{ext}">
<meta name="ac-discovery-keys" content="example.com https://example.com/pubkeys.gpg">
```
+3 -3
View File
@@ -5,19 +5,19 @@
"os": "linux",
"arch": "amd64",
"exec": [
"/ace_validator", "main"
"/ace-validator", "main"
],
"eventHandlers": [
{
"name": "pre-start",
"exec": [
"/ace_validator", "prestart"
"/ace-validator", "prestart"
]
},
{
"name": "post-stop",
"exec": [
"/ace_validator", "poststop"
"/ace-validator", "poststop"
]
}
],
+1 -1
View File
@@ -5,7 +5,7 @@
"os": "linux",
"arch": "amd64",
"exec": [
"/ace_validator", "sidekick"
"/ace-validator", "sidekick"
],
"user": "0",
"group": "0",
+11 -11
View File
@@ -13,25 +13,25 @@ fi
for typ in main sidekick; do
layoutdir="bin/ace_${typ}_layout"
mkdir -p ${layoutdir}/rootfs
cp bin/ace_validator ${layoutdir}/rootfs/
cp bin/ace-validator ${layoutdir}/rootfs/
cp ${PREFIX}/app_manifest_${typ}.json ${layoutdir}/app
# now build the tarball, and sign it
pushd ${layoutdir} >/dev/null
# Set a consistent timestamp so we get a consistent hash
# TODO(jonboulle): make this cleaner..
for path in rootfs rootfs/ace_validator; do
for path in rootfs rootfs/ace-validator; do
touch -a -m -d 1415660606 ${path}
done
../actool build --overwrite --app-manifest app rootfs/ ../ace_validator_${typ}.aci
HASH=sha256-$(sha256sum ../ace_validator_${typ}.aci|awk '{print $1}')
gzip -f ../ace_validator_${typ}.aci
mv ../ace_validator_${typ}.aci.gz ../ace_validator_${typ}.aci
gpg --cipher-algo AES256 --output ace_validator_${typ}.sig --detach-sig ../ace_validator_${typ}.aci
mv ace_validator_${typ}.sig ../
../actool build --overwrite --app-manifest app rootfs/ ../ace-validator-${typ}.aci
HASH=sha256-$(sha256sum ../ace-validator-${typ}.aci|awk '{print $1}')
gzip -f ../ace-validator-${typ}.aci
mv ../ace-validator-${typ}.aci.gz ../ace-validator-${typ}.aci
gpg --cipher-algo AES256 --output ace-validator-${typ}.sig --detach-sig ../ace-validator-${typ}.aci
mv ace-validator-${typ}.sig ../
popd >/dev/null
echo "Wrote ${typ} layout to ${layoutdir}"
echo "Wrote unsigned ${typ} ACI bin/ace_validator_${typ}.aci"
ln -s ${PWD}/bin/ace_validator_${typ}.aci bin/${HASH}
echo "Wrote unsigned ${typ} ACI bin/ace-validator-${typ}.aci"
ln -s ${PWD}/bin/ace-validator-${typ}.aci bin/${HASH}
echo "Wrote ${typ} layout hash bin/${HASH}"
echo "Wrote ${typ} ACI signature bin/ace_validator_${typ}.sig"
echo "Wrote ${typ} ACI signature bin/ace-validator-${typ}.sig"
done
-45
View File
@@ -1,45 +0,0 @@
package main
import (
"fmt"
"net/url"
"runtime"
"strings"
)
const (
defaultVersion = "latest"
defaultOS = runtime.GOOS
defaultArch = runtime.GOARCH
)
// appFromString takes a command line app parameter and returns a map of labels.
//
// Example app parameters:
// example.com/reduce-worker:1.0.0
// example.com/reduce-worker,channel=alpha,label=value
func appFromString(app string) (out map[string]string, err error) {
out = make(map[string]string, 0)
app = strings.Replace(app, ":", ",ver=", -1)
app = "name=" + app
v, err := url.ParseQuery(strings.Replace(app, ",", "&", -1))
if err != nil {
return nil, err
}
for key, val := range v {
if len(val) > 1 {
return nil, fmt.Errorf("label %s with multiple values %q", key, val)
}
out[key] = val[0]
}
if out["ver"] == "" {
out["ver"] = defaultVersion
}
if out["os"] == "" {
out["os"] = defaultOS
}
if out["arch"] == "" {
out["arch"] = defaultArch
}
return
}
+1 -1
View File
@@ -17,7 +17,7 @@ echo "Building actool..."
go build -o $GOBIN/actool ${REPO_PATH}/app-container/actool
echo "Building ACE validator..."
GOOS=linux CGO_ENABLED=0 go build -a -ldflags '-extldflags "-static"' -o $GOBIN/ace_validator ${REPO_PATH}/app-container/ace
GOOS=linux CGO_ENABLED=0 go build -a -ldflags '-extldflags "-static"' -o $GOBIN/ace-validator ${REPO_PATH}/app-container/ace
echo "Building init (stage1)..."
go build -o $GOBIN/init ${REPO_PATH}/stage1