figured out way to attach local .ssh dir so that docker container will have permissions to push to repo we are versioning
This commit is contained in:
@ -5,8 +5,10 @@ Semantic Versioning
|
|||||||
Usage
|
Usage
|
||||||
-----
|
-----
|
||||||
|
|
||||||
|
# FULL_PATH_TO_LOCAL_REPO gives container access to repo to be versioned
|
||||||
|
# FULL_PATH_TO_SSH_FOLDER gives container access to ssh keys to be able to push repo
|
||||||
docker build -t semver .
|
docker build -t semver .
|
||||||
docker run -v FULL_PATH_TO_LOCAL_REPO:/application_repo semver
|
docker run -v FULL_PATH_TO_LOCAL_REPO:/application_repo -v FULL_PATH_TO_SSH_FOLDER:/root/.ssh semver
|
||||||
|
|
||||||
# after this finishes must go to FULL_PATH_TO_LOCAL_REPO and push yourself
|
# after this finishes must go to FULL_PATH_TO_LOCAL_REPO and push yourself
|
||||||
git push origin develop
|
git push origin develop
|
||||||
|
11
semver.py
11
semver.py
@ -72,10 +72,6 @@ class SemVer(object):
|
|||||||
return self
|
return self
|
||||||
|
|
||||||
def commit_and_push(self):
|
def commit_and_push(self):
|
||||||
'''
|
|
||||||
' this will be difficult to do because we'd need to setup credentials in
|
|
||||||
' docker container for git remote repo access
|
|
||||||
'
|
|
||||||
# push versioning commit
|
# push versioning commit
|
||||||
p = subprocess.Popen(['git', 'push', 'origin', 'develop'],
|
p = subprocess.Popen(['git', 'push', 'origin', 'develop'],
|
||||||
cwd='/application_repo')
|
cwd='/application_repo')
|
||||||
@ -85,7 +81,6 @@ class SemVer(object):
|
|||||||
p = subprocess.Popen(['git', 'push', 'origin', '--tags'],
|
p = subprocess.Popen(['git', 'push', 'origin', '--tags'],
|
||||||
cwd='/application_repo')
|
cwd='/application_repo')
|
||||||
p.wait()
|
p.wait()
|
||||||
'''
|
|
||||||
return self
|
return self
|
||||||
|
|
||||||
# 1) get branches from last commit message
|
# 1) get branches from last commit message
|
||||||
@ -101,8 +96,12 @@ class SemVer(object):
|
|||||||
raise Exception('No git flow branch found')
|
raise Exception('No git flow branch found')
|
||||||
self.setup_git_user()
|
self.setup_git_user()
|
||||||
self.version_repo()
|
self.version_repo()
|
||||||
|
self.commit_and_push()
|
||||||
return self
|
return self
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
SemVer().run()
|
try:
|
||||||
|
SemVer().run()
|
||||||
|
except Exception as e:
|
||||||
|
print e.message
|
||||||
|
Reference in New Issue
Block a user