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 windows github action workflow #123

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft

Add windows github action workflow #123

wants to merge 1 commit into from

Conversation

webframp
Copy link
Contributor

At the moment I don't believe this will work because it depends on
services which require a runs-on value of a linux host.

Opening this as a draft PR just to track attempts at solving this.


Pull Request Checklist

Is this in reference to an existing issue?

Yes, #68

General

  • Update Changelog following the conventions laid out here

  • Update README with any necessary configuration snippets

  • Cookstyle (rubocop) passes

  • Rspec (unit tests) passes

  • Inspec (integration tests) passes

New Features

  • Added a Testing Artifact as either an automated test or a manual artifact on the PR.

  • Added documentation for it to the README.md

Purpose

Add a GH Action for testing the windows agent in CI

Known Compatibility Issues

In cookbook none. With GH Actions, service containers aren't supported on windows runners.

At the moment I don't believe this will work because it depends on
services which require a `runs-on` value of a linux host.

Opening this as a draft PR just to track attempts at solving this.
@webframp webframp requested a review from a team as a code owner October 25, 2020 23:26
@webframp webframp marked this pull request as draft October 25, 2020 23:26
@webframp webframp linked an issue Oct 25, 2020 that may be closed by this pull request
@webframp
Copy link
Contributor Author

Known issue right now that services with GH Actions requires linux:

Error: Container operations are only supported on Linux runners

@webframp
Copy link
Contributor Author

Hey @derekgroh I don't have any great ideas for how best to handle this, but if you have experience with windows + GH Actions feel free to push fixes to this branch with ideas.

@derekgroh
Copy link
Contributor

@webframp Not really, just started trying to play with it. We can try to connect on Slack and maybe figure it out.

@derekgroh
Copy link
Contributor

@webframp Can you allow me to push against this branch?

@majormoses
Copy link
Contributor

@derekgroh I think there are several options and it depends on what you want to do:

  • invite you as a collaborator onto the project, if you would like to help maintain the project I would support it but lets open a github issue for it. While this is not under the plugins org I would like us to follow a process that is open (we may want to document this and our differences from plugins): https://github.com/sensu-plugins/community/blob/master/HOW_TO_BECOME_A_MAINTAINER.md
  • Sean can fork the repo onto his personal and give you access there
  • You can fork the repo, make your updates, provide a branch or link to your updates, we can apply the patch on your behalf

I am going to write up an issue to better outline what being a maintainer should look like.

@majormoses majormoses mentioned this pull request Nov 3, 2020
3 tasks
@webframp
Copy link
Contributor Author

webframp commented Nov 4, 2020

@derekgroh Feel free to open something new based on this branch too, I don't do a lot with Windows these days so this is just sort of a brain dump.

I have no problem closing and not merging this.

@derekgroh
Copy link
Contributor

derekgroh commented Nov 4, 2020

Here's what I was able to work out.

Target:  winrm://vagrant@http://172.26.145.20:5985/wsman:3389

  Command: `cmd.exe /c "echo %PATH%"`
     [PASS]  stdout is expected to include "c:\\Program Files\\Sensu\\sensu-cli\\bin\\sensuctl"
  File c:\Program Files\Sensu\sensu-cli\bin\sensuctl\sensuctl.exe
     [PASS]  is expected to exist
  Command: `sensuctl entity list`
     [PASS]  stdout is expected to match /backend/
     [PASS]  exit_status is expected to eq 0

Test Summary: 4 successful, 0 failures, 0 skipped
       Finished verifying <ctl-windows-2019> (0m9.35s).
-----> Test Kitchen is finished. (5m50.69s)
---
name: windows

"on":
  pull_request:
  push:
    branches:
      - master

jobs:
  windows_agent:
    runs-on: windows-latest
    steps:
      - name: Check out code
        uses: actions/checkout@master
      - name: Install Chef
        uses: actionshub/chef-install@master
      - name: Create directory
        run: mkdir D:\a\berks-cookbooks\
      - name: Create Link
        run: cmd /c mklink /d  D:\a\cookbooks\ D:\a\berks-cookbooks\         
      - name: Berks
        working-directory: D:\a\
        run: berks vendor -b D:\a\sensu-go-chef\sensu-go-chef\Berksfile
      - name: Chef Zero
        working-directory: D:\a\cookbooks\sensu-go\
        env:
         CHEF_LICENSE: accept-no-persist
        run: chef-client -z -o sensu_test::agent
      - name: Verify
        run: chef exec inspec exec D:\a\sensu-go-chef\sensu-go-chef\test\integration\agent\agent_spec.rb
        env:
         CHEF_LICENSE: accept-no-persist     
  windows_ctl:
    runs-on: windows-latest
    steps:
      - name: Check out code
        uses: actions/checkout@master
      - name: Install Chef
        uses: actionshub/chef-install@master
      - name: Create directory
        run: mkdir D:\a\berks-cookbooks\
      - name: Create Link
        run: cmd /c mklink /d  D:\a\cookbooks\ D:\a\berks-cookbooks\         
      - name: Berks
        working-directory: D:\a\
        run: berks vendor -b D:\a\sensu-go-chef\sensu-go-chef\Berksfile
      - name: Chef Zero
        working-directory: D:\a\cookbooks\sensu-go\
        env:
         CHEF_LICENSE: accept-no-persist
        run: chef-client -z -o sensu_test::ctl
      # - name: Verify
        # run: chef exec inspec exec D:\a\sensu-go-chef\sensu-go-chef\test\integration\ctl\ctl_spec.rb
        # env:
         # CHEF_LICENSE: accept-no-persist

The ctl job fails out with the path and backend not matching, where as test kitchen detects them correctly (see above). This seems like an environment issue with the platform GitHub is using, but I can't be sure.

Not sure if the ctl run should be removed or how best to test, I've also changed the test to and list backends instead of users

sensu_ctl 'default' do
  action [:install, :configure]
  username 'guest'
  password 'i<3sensu'
  backend_url 'https://caviar.tf.sensu.io:8080/'
  debug true
end

This allows ctl testing against a running backend, which should always be available

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add sensuctl test for windows platform
3 participants