Skip to content

Commit

Permalink
Merge pull request #111 from teluq-pbrideau/feat/sensitive_environment
Browse files Browse the repository at this point in the history
Support for sensitive environment variables
  • Loading branch information
bastelfreak committed Jul 10, 2024
2 parents 9fc0b12 + 2e5b981 commit 6e5296c
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
2 changes: 1 addition & 1 deletion REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -900,7 +900,7 @@ Alias of `Pattern[/(?i:\A(((0|[1-9][0-9]*):)?[0-9]([a-z0-9.+-~]*|[a-z0-9.+~]*-[a

Valid $environment parameter to Cron::Job.

Alias of `Array[Pattern[/(?i:\A[a-z_][a-z0-9_]*=[^\0]*\z)/]]`
Alias of `Array[Variant[Pattern[/(?i:\A[a-z_][a-z0-9_]*=[^\0]*\z)/],Sensitive[Pattern[/(?i:\A[a-z_][a-z0-9_]*=[^\0]*\z)/]]]]`

### <a name="Cron--Hour"></a>`Cron::Hour`

Expand Down
14 changes: 14 additions & 0 deletions spec/defines/job_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,20 @@
end
end

context 'job with sensitive environment' do
let(:params) do
{
command: '/bin/true',
environment: [sensitive('KEY=value')]
}
end

it do
is_expected.to compile
is_expected.to contain_file("job_#{title}").with_content('Sensitive [value redacted]')
end
end

# Multiple test cases for variations on time field values
params_cases.each do |desc, p|
context "job with #{desc}" do
Expand Down
2 changes: 1 addition & 1 deletion types/environment.pp
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# Valid $environment parameter to Cron::Job.
type Cron::Environment = Array[Pattern[/(?i:\A[a-z_][a-z0-9_]*=[^\0]*\z)/]]
type Cron::Environment = Array[Variant[Pattern[/(?i:\A[a-z_][a-z0-9_]*=[^\0]*\z)/],Sensitive[Pattern[/(?i:\A[a-z_][a-z0-9_]*=[^\0]*\z)/]]]]

0 comments on commit 6e5296c

Please sign in to comment.