Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Turn release.py into a binary to build the artifacts for all the different contexts #133

Merged
merged 4 commits into from
Nov 14, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ confidence=
# --enable=similarities". If you want to run only the classes checker, but have
# no Warning level messages displayed, use"--disable=all --enable=classes
# --disable=W"
disable=import-star-module-level,old-octal-literal,oct-method,print-statement,unpacking-in-except,parameter-unpacking,backtick,old-raise-syntax,old-ne-operator,long-suffix,dict-view-method,dict-iter-method,metaclass-assignment,next-method-called,raising-string,indexing-exception,raw_input-builtin,long-builtin,file-builtin,execfile-builtin,coerce-builtin,cmp-builtin,buffer-builtin,basestring-builtin,apply-builtin,filter-builtin-not-iterating,using-cmp-argument,useless-suppression,range-builtin-not-iterating,suppressed-message,missing-docstring,no-absolute-import,old-division,cmp-method,reload-builtin,zip-builtin-not-iterating,intern-builtin,unichr-builtin,reduce-builtin,standarderror-builtin,unicode-builtin,xrange-builtin,coerce-method,delslice-method,getslice-method,setslice-method,input-builtin,round-builtin,hex-method,nonzero-method,map-builtin-not-iterating,relative-import,invalid-name,bad-continuation,no-member,locally-disabled,fixme,import-error
disable=import-star-module-level,old-octal-literal,oct-method,print-statement,unpacking-in-except,parameter-unpacking,backtick,old-raise-syntax,old-ne-operator,long-suffix,dict-view-method,dict-iter-method,metaclass-assignment,next-method-called,raising-string,indexing-exception,raw_input-builtin,long-builtin,file-builtin,execfile-builtin,coerce-builtin,cmp-builtin,buffer-builtin,basestring-builtin,apply-builtin,filter-builtin-not-iterating,using-cmp-argument,useless-suppression,range-builtin-not-iterating,suppressed-message,missing-docstring,no-absolute-import,old-division,cmp-method,reload-builtin,zip-builtin-not-iterating,intern-builtin,unichr-builtin,reduce-builtin,standarderror-builtin,unicode-builtin,xrange-builtin,coerce-method,delslice-method,getslice-method,setslice-method,input-builtin,round-builtin,hex-method,nonzero-method,map-builtin-not-iterating,relative-import,invalid-name,bad-continuation,no-member,locally-disabled,fixme,import-error,too-many-locals


[REPORTS]
Expand Down
20 changes: 18 additions & 2 deletions developer_guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
Create a symbolic link inside your GOPATH to the location you checked out the code

```sh
mkdir -p ${GOPATH}/src/github.com/jlewi
ln -sf ${GIT_TRAINING} ${GOPATH}/src/mlkube.io
mkdir -p ${GOPATH}/src/github.com/tensorflow
ln -sf ${GIT_TRAINING} ${GOPATH}/src/github.com/tensorflow/k8s
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like ${GIT_TRAINING} is the same as ${GOPATH}/src/github.com/tensorflow/k8s in some case.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure I understand the question. Its certainly possible to check out the repository directly into your GOLANG src tree in which case you don't need to create a symbolic link.

```

* GIT_TRAINING should be the location where you checked out https://github.com/tensorflow/k8s
Expand All @@ -27,6 +27,22 @@ Build it
go install github.com/tensorflow/k8s/cmd/tf_operator
```

## Building all the artifacts.

To build the following artifacts:

* Docker image for the operator
* Helm chart for deploying it

You can run

```sh
python -m release.py --registry=${REGISTRY}
```
* The docker image will be tagged into your registry
* The helm chart will be created in **./bin**


## Running the Operator Locally

Running the operator locally (as opposed to deploying it on a K8s cluster) is convenient for debugging/development.
Expand Down
2 changes: 2 additions & 0 deletions images/tf_operator/build_and_push.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@

import yaml

# TODO(jlewi): build_and_push.py should be obsolete. We should be able to
# use py/release.py

def GetGitHash(root_dir):
# The image tag is based on the githash.
Expand Down
17 changes: 11 additions & 6 deletions py/build_and_push_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,24 @@

import jinja2

def GetGitHash():
def GetGitHash(root_dir=None):
# The image tag is based on the githash.
git_hash = subprocess.check_output(["git", "rev-parse", "--short", "HEAD"])
git_hash = subprocess.check_output(["git", "rev-parse", "--short", "HEAD"],
cwd=root_dir).decode("utf-8")
git_hash = git_hash.strip()
modified_files = subprocess.check_output(["git", "ls-files", "--modified"])
untracked_files = subprocess.check_output(["git", "ls-files", "--others",
"--exclude-standard"])

modified_files = subprocess.check_output(["git", "ls-files", "--modified"],
cwd=root_dir)
untracked_files = subprocess.check_output(
["git", "ls-files", "--others", "--exclude-standard"], cwd=root_dir)
if modified_files or untracked_files:
diff = subprocess.check_output(["git", "diff"])
diff = subprocess.check_output(["git", "diff"], cwd=root_dir)

sha = hashlib.sha256()
sha.update(diff)
diffhash = sha.hexdigest()[0:7]
git_hash = "{0}-dirty-{1}".format(git_hash, diffhash)

return git_hash

def run_and_stream(cmd):
Expand Down
Loading