-
Notifications
You must be signed in to change notification settings - Fork 180
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
add start_swarm_manager use case #221
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
# (c) Copyright 2014 Hewlett-Packard Development Company, L.P. | ||
# All rights reserved. This program and the accompanying materials | ||
# are made available under the terms of the Apache License v2.0 which accompany this distribution. | ||
# | ||
# The Apache License is available at | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
######################################################################################################## | ||
# Starts the Swarm manager. | ||
# | ||
# Inputs: | ||
# - swarm_port - port of the host used by the Swarm manager | ||
# - cluster_id - ID of the Swarm cluster | ||
# - swarm_image - optional - Docker image the Swarm agent container is created from - Default: swarm (latest) | ||
# - host - Docker machine host | ||
# - port - optional - SSH port | ||
# - username - Docker machine username | ||
# - password - optional - Docker machine password | ||
# - private_key_file - optional - path to private key file | ||
# - character_set - optional - character encoding used for input stream encoding from target machine - Valid: SJIS, EUC-JP, UTF-8 | ||
# - pty - optional - whether to use PTY - Valid: true, false | ||
# - timeout - optional - time in milliseconds to wait for the command to complete | ||
# - close_session - optional - if false SSH session will be cached for future calls during the life of the flow, | ||
# - if true the SSH session used will be closed; | ||
# - Valid: true, false | ||
# - agent_forwarding - optional - whether to forward the user authentication agent | ||
# Outputs: | ||
# - manager_container_ID - ID of the created manager container | ||
######################################################################################################## | ||
|
||
namespace: io.cloudslang.docker.swarm | ||
|
||
imports: | ||
containers: io.cloudslang.docker.containers | ||
|
||
flow: | ||
name: start_swarm_manager | ||
inputs: | ||
- swarm_port | ||
- cluster_id | ||
- swarm_image: | ||
default: "'swarm'" | ||
- host | ||
- port: | ||
required: false | ||
- username | ||
- password: | ||
required: false | ||
- private_key_file: | ||
required: false | ||
- character_set: | ||
required: false | ||
- pty: | ||
required: false | ||
- timeout: | ||
required: false | ||
- close_session: | ||
required: false | ||
- agent_forwarding: | ||
required: false | ||
|
||
workflow: | ||
- run_manager_container: | ||
do: | ||
containers.run_container: | ||
- container_params: > | ||
'-p ' + swarm_port + ':2375' | ||
- container_command: > | ||
'manage token://' + cluster_id | ||
- image_name: swarm_image | ||
- host | ||
- port: | ||
required: false | ||
- username | ||
- password: | ||
required: false | ||
- private_key_file: | ||
required: false | ||
- characterSet: | ||
default: character_set | ||
required: false | ||
- pty: | ||
required: false | ||
- timeout: | ||
required: false | ||
- closeSession: | ||
default: close_session | ||
required: false | ||
- agentForwarding: | ||
default: agent_forwarding | ||
required: false | ||
publish: | ||
- manager_container_ID: container_ID | ||
outputs: | ||
- manager_container_ID |
19 changes: 19 additions & 0 deletions
19
test/io/cloudslang/docker/swarm/start_swarm_manager.inputs.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# (c) Copyright 2014 Hewlett-Packard Development Company, L.P. | ||
# All rights reserved. This program and the accompanying materials | ||
# are made available under the terms of the Apache License v2.0 which accompany this distribution. | ||
# | ||
# The Apache License is available at | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
######################################################################################################## | ||
test_start_swarm_manager_success: | ||
testSuites: [swarm_local] | ||
description: Tests SUCCESS case - this test needs to be run on the local machine by activating the test suite and supplying the inputs | ||
testFlowPath: io.cloudslang.docker.swarm.test_start_swarm_manager | ||
inputs: | ||
- swarm_port: "2375" | ||
- cluster_id: 3572e1a3ad805fca3f80949af011fad2 | ||
- host: 111.111.111.111 | ||
- username: core | ||
- private_key_file: c:/.../id_rsa | ||
result: SUCCESS |
125 changes: 125 additions & 0 deletions
125
test/io/cloudslang/docker/swarm/test_start_swarm_manager.sl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,125 @@ | ||
# (c) Copyright 2014 Hewlett-Packard Development Company, L.P. | ||
# All rights reserved. This program and the accompanying materials | ||
# are made available under the terms of the Apache License v2.0 which accompany this distribution. | ||
# | ||
# The Apache License is available at | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
#################################################### | ||
|
||
namespace: io.cloudslang.docker.swarm | ||
|
||
imports: | ||
maintenance: io.cloudslang.docker.maintenance | ||
swarm: io.cloudslang.docker.swarm | ||
containers: io.cloudslang.docker.containers | ||
strings: io.cloudslang.base.strings | ||
|
||
flow: | ||
name: test_start_swarm_manager | ||
inputs: | ||
- swarm_port | ||
- cluster_id | ||
- host | ||
- port: | ||
required: false | ||
- username | ||
- password: | ||
required: false | ||
- private_key_file: | ||
required: false | ||
- timeout: | ||
required: false | ||
|
||
workflow: | ||
- pre_clear_machine: | ||
do: | ||
maintenance.clear_docker_host: | ||
- docker_host: host | ||
- docker_username: username | ||
- docker_password: | ||
default: password | ||
required: false | ||
- private_key_file: | ||
required: false | ||
- timeout: | ||
required: false | ||
- port: | ||
required: false | ||
navigate: | ||
SUCCESS: start_swarm_manager | ||
FAILURE: PRE_CLEAR_MACHINE_PROBLEM | ||
|
||
- start_swarm_manager: | ||
do: | ||
swarm.start_swarm_manager: | ||
- swarm_port | ||
- cluster_id | ||
- host | ||
- port: | ||
required: false | ||
- username | ||
- password: | ||
required: false | ||
- private_key_file: | ||
required: false | ||
- timeout: | ||
required: false | ||
publish: | ||
- expected_container_id: manager_container_ID | ||
navigate: | ||
SUCCESS: get_running_container_ids | ||
FAILURE: FAILURE | ||
|
||
- get_running_container_ids: | ||
do: | ||
containers.get_all_containers: | ||
- host | ||
- port: | ||
required: false | ||
- username | ||
- password: | ||
required: false | ||
- private_key_file: | ||
required: false | ||
- timeout: | ||
required: false | ||
publish: | ||
- actual_container_id: container_list | ||
navigate: | ||
SUCCESS: verify_container_is_running | ||
FAILURE: GET_RUNNING_CONTAINER_IDS_PROBLEM | ||
|
||
- verify_container_is_running: | ||
do: | ||
strings.string_occurrence_counter: | ||
- string_in_which_to_search: expected_container_id | ||
- string_to_find: actual_container_id | ||
navigate: | ||
SUCCESS: post_clear_machine | ||
FAILURE: VERIFY_CONTAINER_IS_RUNNING_PROBLEM | ||
|
||
- post_clear_machine: | ||
do: | ||
maintenance.clear_docker_host: | ||
- docker_host: host | ||
- docker_username: username | ||
- docker_password: | ||
default: password | ||
required: false | ||
- private_key_file: | ||
required: false | ||
- timeout: | ||
required: false | ||
- port: | ||
required: false | ||
navigate: | ||
SUCCESS: SUCCESS | ||
FAILURE: POST_CLEAR_MACHINE_PROBLEM | ||
results: | ||
- SUCCESS | ||
- FAILURE | ||
- PRE_CLEAR_MACHINE_PROBLEM | ||
- GET_RUNNING_CONTAINER_IDS_PROBLEM | ||
- VERIFY_CONTAINER_IS_RUNNING_PROBLEM | ||
- POST_CLEAR_MACHINE_PROBLEM |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why can't you run swarm on travis/circleci?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
well, we need Docker hosts for it - maybe we can use multiple dind containers
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that's one possibility...
but swarm_manager can not run on a single host?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Bonczidai ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
working on a local test first, then will try to align it with travis / circleci