def post_releases_start(release_id): """ Indicate that a release is starting This trigger the start of the deploy :param string release_id: Release UUID **Example curl**: .. sourcecode:: shell curl -H "Content-Type: application/json" \\ -X POST http://127.0.0.1/releases/${RELEASE_ID}/deploy """ release = fetch_release(release_id) # TODO call deploy Class start Method app.logger.info("Release start, release {}".format(release_id)) release.start() db.session.add(release) db.session.commit() deploy = ShellDeploy(release) deploy.start() return '', 204
def test_start(self): """ Test that start emits a shell command :return: """ with ConfigChange('deploy', 'timeout', '3'), \ ConfigChange('deploy_shell', 'command_path', '/bin/true'): deploy = ShellDeploy(self.release) deploy.server_url = self.get_server_url() deploy.start()
def test_start(self): """ Test that start emits a shell command """ with ConfigChange('deploy', 'timeout', '3'), \ ConfigChange('deploy_shell', 'command_path', '/bin/true'): deploy = ShellDeploy(self.release) # Override server_url, normally it is set by config: deploy.server_url = self.get_server_url() deploy.start()
def test_start_example_deployer(self): """ Test the example deployer completes DOESN'T WORK ON TRAVIS, as /bin/env python gives the system python """ with ConfigChange('deploy', 'timeout', '3'): deploy = ShellDeploy(self.release) # Override server_url, normally it is set by config: deploy.server_url = self.get_server_url() deploy.start()
def test_output(self): """ Test that we return the output of the deploy Not a good test, as it relies on the test-package being an argument, and simply echoing it back. This is the "spec", but this test could break if the arguments change. """ with ConfigChange('deploy', 'timeout', '3'), \ ConfigChange('deploy_shell', 'command_path', '/bin/echo'): deploy = ShellDeploy(self.release) # Override server_url, normally it is set by config: deploy.server_url = self.get_server_url() output = deploy.start() self.assertEqual(output['stdout'], b'test-package=1.2.3\n')
def post_releases_deploy(release_id): """ Deploy a Release :param string release_id: Release UUID **Example curl**: .. sourcecode:: shell curl -H "Content-Type: application/json" \\ -X POST http://127.0.0.1/releases/${RELEASE_ID}/deploy """ release = fetch_release(release_id) app.logger.info("Release start, release {}".format(release_id)) release.start() db.session.add(release) db.session.commit() # TODO call deploy Class start Method, i.e. pure python rather than shell deploy = ShellDeploy(release) output = deploy.start() return jsonify(output), 200