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

Add Docker Swarm support #1296

Open
wants to merge 28 commits into
base: main
Choose a base branch
from
Open

Add Docker Swarm support #1296

wants to merge 28 commits into from

Conversation

damacus
Copy link
Member

@damacus damacus commented Dec 14, 2024

  • Adds swarm init, join, service & token resources

Signed-off-by: Dan Webb [email protected]

@damacus damacus requested a review from a team as a code owner December 14, 2024 23:08
@damacus damacus requested a review from Copilot December 17, 2024 09:32
@damacus damacus self-assigned this Dec 17, 2024
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot reviewed 8 out of 23 changed files in this pull request and generated 1 comment.

Files not reviewed (15)
  • .tool-versions: Language not supported
  • README.md: Evaluated as low risk
  • CHANGELOG.md: Evaluated as low risk
  • kitchen.yml: Evaluated as low risk
  • .github/workflows/ci.yml: Evaluated as low risk
  • kitchen.exec.yml: Evaluated as low risk
  • documentation/docker_swarm_service.md: Evaluated as low risk
  • test/cookbooks/docker_test/recipes/swarm_default.rb: Evaluated as low risk
  • spec/unit/resources/swarm_service_spec.rb: Evaluated as low risk
  • documentation/docker_swarm_token.md: Evaluated as low risk
  • resources/swarm_init.rb: Evaluated as low risk
  • test/cookbooks/docker_test/recipes/swarm_init.rb: Evaluated as low risk
  • spec/unit/resources/swarm_join_spec.rb: Evaluated as low risk
  • documentation/docker_swarm_init.md: Evaluated as low risk
  • resources/swarm_join.rb: Evaluated as low risk
Comments suppressed due to low confidence (2)

resources/swarm_token.rb:25

  • [nitpick] The error message could be more descriptive by specifying which token type it failed to get.
raise "Error getting #{token_type} token: #{cmd.stderr}" if cmd.error?

resources/swarm_token.rb:38

  • [nitpick] The error message could be more descriptive by specifying which token type it failed to rotate.
raise "Error rotating #{token_type} token: #{cmd.stderr}" if cmd.error?

resources/swarm_service.rb Show resolved Hide resolved
@Stromweld Stromweld added the Release: Minor Release to Chef Supermarket as a minor release when merged label Dec 18, 2024
- Adds swarm init, join, service & token resources

Signed-off-by: Dan Webb <[email protected]>
Signed-off-by: Dan Webb <[email protected]>
@Stromweld
Copy link
Contributor

github actions flagged your matrix of OS's as missing 2 spaces in the indentation in your ci.yaml file causing the yaml lint job to fail.

Signed-off-by: Dan Webb <[email protected]>
Signed-off-by: Dan Webb <[email protected]>
Signed-off-by: Dan Webb <[email protected]>
Signed-off-by: Dan Webb <[email protected]>
Signed-off-by: Dan Webb <[email protected]>
@damacus damacus force-pushed the docker-swarm branch 6 times, most recently from 740608f to 9fc10c4 Compare January 21, 2025 09:52
fix recipes
break specs
fix lefthook

Signed-off-by: Dan Webb <[email protected]>
Signed-off-by: Dan Webb <[email protected]>
Signed-off-by: Dan Webb <[email protected]>
Signed-off-by: Dan Webb <[email protected]>
Signed-off-by: Dan Webb <[email protected]>
Signed-off-by: Dan Webb <[email protected]>
Signed-off-by: Dan Webb <[email protected]>
Signed-off-by: Dan Webb <[email protected]>
@damacus damacus requested a review from Copilot January 23, 2025 10:29
Signed-off-by: Dan Webb <[email protected]>
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot reviewed 15 out of 30 changed files in this pull request and generated 2 comments.

Files not reviewed (15)
  • .tool-versions: Language not supported
  • README.md: Evaluated as low risk
  • CHANGELOG.md: Evaluated as low risk
  • resources/installation_package.rb: Evaluated as low risk
  • kitchen.yml: Evaluated as low risk
  • kitchen.exec.yml: Evaluated as low risk
  • .github/workflows/ci.yml: Evaluated as low risk
  • resources/swarm_join.rb: Evaluated as low risk
  • documentation/docker_swarm_token.md: Evaluated as low risk
  • resources/swarm_init.rb: Evaluated as low risk
  • documentation/docker_swarm_service.md: Evaluated as low risk
  • documentation/docker_swarm_init.md: Evaluated as low risk
  • libraries/helpers_swarm.rb: Evaluated as low risk
  • lefthook.yml: Evaluated as low risk
  • documentation/docker_swarm_join.md: Evaluated as low risk
Comments suppressed due to low confidence (2)

.github/actions/chef-install/action.yml:41

  • The format function is not available in PowerShell by default. Use string interpolation instead: -version ${inputs.version}.
install -channel ${{ inputs.channel }} -project ${{ inputs.project }} ${{ inputs.version && format('-version {0}', inputs.version) }}

.github/actions/test-kitchen/action.yml:25

  • [nitpick] The default value for 'kitchen-command' is set to 'test'. Ensure this default value is appropriate for all scenarios where this action might be used.
default: 'test'

- name: Install Chef
shell: bash
run: |
curl -L "https://trial-acceptance.downloads.chef.co/install.sh?license_id=#${{ env.licence }}" | sudo bash -s -- -P chef
Copy link
Preview

Copilot AI Jan 23, 2025

Choose a reason for hiding this comment

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

The variable name 'licence' is a typo. It should be 'license'.

Suggested change
curl -L "https://trial-acceptance.downloads.chef.co/install.sh?license_id=#${{ env.licence }}" | sudo bash -s -- -P chef
curl -L "https://trial-acceptance.downloads.chef.co/install.sh?license_id=#${{ env.license }}" | sudo bash -s -- -P chef

Copilot is powered by AI, so mistakes are possible. Review output carefully before use.

Positive Feedback
Negative Feedback

Provide additional feedback

Please help us improve GitHub Copilot by sharing more details about this comment.

Please select one or more of the options
end

action_class do
def service_exists?(new_resource)
Copy link
Preview

Copilot AI Jan 23, 2025

Choose a reason for hiding this comment

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

The method service_exists? is defined twice, once in the libraries/helpers_swarm.rb file and once in the action_class of the docker_swarm_service resource. Remove the redundant definition from the action_class and use the one from the libraries/helpers_swarm.rb file.

Suggested change
def service_exists?(new_resource)
# def service_exists?(new_resource)

Copilot is powered by AI, so mistakes are possible. Review output carefully before use.

Positive Feedback
Negative Feedback

Provide additional feedback

Please help us improve GitHub Copilot by sharing more details about this comment.

Please select one or more of the options
Signed-off-by: Dan Webb <[email protected]>
Signed-off-by: Dan Webb <[email protected]>
Signed-off-by: Dan Webb <[email protected]>
Signed-off-by: Dan Webb <[email protected]>
Signed-off-by: Dan Webb <[email protected]>
Signed-off-by: Dan Webb <[email protected]>
@damacus damacus force-pushed the docker-swarm branch 2 times, most recently from cc8bf85 to 6f6b26d Compare January 27, 2025 11:38
Signed-off-by: Dan Webb <[email protected]>
Signed-off-by: Dan Webb <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Release: Minor Release to Chef Supermarket as a minor release when merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants