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: Job filter as a context variable #2974

Merged
merged 1 commit into from Dec 8, 2017

Conversation

Projects
None yet
2 participants
@adambrett
Contributor

adambrett commented Dec 4, 2017

We have a situation where we need to do the following:

  1. have a common deployment job that takes a number of parameters and can deploy any application
  2. have individual jobs that reference the common job with the parameters filled in for that specific application
  3. have a series of steps performed on each server before the deployment
  4. have the deployment happen sequentially
  5. only have a single job reference in each of the "individual" jobs (for ease of maintenance and to ensure governance/compliance)
  6. have node filters work normally

It looks something like this in reality:

Node 1
--- Run puppet
Node 2
--- Run puppet

Node 1
--- Drain load balancer
--- Deploy application
--- Undrain load balancer

Node 2
--- Drain load balancer
--- Deploy application
--- Undrain load balancer

Workflow step
--- Notify deployment metrics
--- Update changelog
Application Job (with node filter)
└── Deployment Job (option.NODE as node filter) [workflow step] step first ordering
          └── Puppet Job (option.NODE as node filter)
          └── Drain/Deploy/Undrain Job (option.NODE as node filter) node first ordering
                     └── Drain
                     └── Deploy
                     └── UnDrain
          └── Post Deployment Tasks

There is currently no way to achieve this in rundeck, the closest we have is to pass in the nodes as an option to the top level job, but then we lose the node filter functionality.

By adding the job.filter variable as a job context variable, and then passing this to the NODE option of each job it is possible. We need job.filter to be available to ensure that the normal filter functionality continues to behave as expected.

@gschueler

This comment has been minimized.

Show comment
Hide comment
@gschueler

gschueler Dec 4, 2017

Member

This seems like a good enhancement. It would be useful to have a test case to verify the behavior

Member

gschueler commented Dec 4, 2017

This seems like a good enhancement. It would be useful to have a test case to verify the behavior

@adambrett

This comment has been minimized.

Show comment
Hide comment
@adambrett

adambrett Dec 5, 2017

Contributor

@gschueler I've added a simple unit test; there didn't seem to be anything already testing the context variable functionality that I could add it on to.

If you meant for me to add an integration or acceptance test creating all the jobs and linking them together... I have no idea where to start with that.

I could easily provide some terraform manifests or job yaml files that are linked correctly but don't know how I'd hook that into the CI/build in order to test it.

Contributor

adambrett commented Dec 5, 2017

@gschueler I've added a simple unit test; there didn't seem to be anything already testing the context variable functionality that I could add it on to.

If you meant for me to add an integration or acceptance test creating all the jobs and linking them together... I have no idea where to start with that.

I could easily provide some terraform manifests or job yaml files that are linked correctly but don't know how I'd hook that into the CI/build in order to test it.

@gschueler gschueler added this to the 2.10.2 milestone Dec 5, 2017

@gschueler gschueler merged commit 15a1221 into rundeck:master Dec 8, 2017

9 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
security/snyk No new issues
Details
security/snyk - build.gradle No new issues
Details
security/snyk - core/build.gradle No new issues
Details
security/snyk - rundeck-launcher/build.gradle No new issues
Details
security/snyk - rundeck-launcher/launcher/build.gradle No new issues
Details
security/snyk - rundeck-launcher/rundeck-jetty-server/build.gradle No new issues
Details
security/snyk - rundeck-storage/build.gradle No new issues
Details
security/snyk - rundeckapp/build.gradle No new issues
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment