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

Feature: add datetime to rules context #484

Merged
merged 5 commits into from
Apr 19, 2024

Conversation

Guts
Copy link
Owner

@Guts Guts commented Apr 18, 2024

This PR adds date information to rules context allowing to condition a profile deployment based on current year, month or day.

In the following example, the profile is installed only if QDT runs on a Linux operating system and if the current year >= 2023:

{
  "$schema": "https://raw.githubusercontent.com/Guts/qgis-deployment-cli/main/docs/schemas/profile/qgis_profile.json",
  "name": "QDT Only Linux",
  "folder_name": "qdt_only_linux",
  "description": "Demonstrating a QDT profile that's deployed only on Linux.",
  "author": "Julien Moura",
  "email": "infos+qdt@oslandia.com",
  "qgisMinimumVersion": "3.34.0",
  "qgisMaximumVersion": "3.99.10",
  "version": "1.0.0",
  "rules": [
    {
      "name": "Environment",
      "description": "Profile is configured to run only on Linux.",
      "conditions": {
        "all": [
          {
            "path": "$.environment.operating_system_code",
            "value": "linux",
            "operator": "equal"
          },
          {
            "path": "$.date.current_year",
            "value": 2023,
            "operator": "greater_than_inclusive"
          }
        ]
      }
    }
  ]
}

Depends on #481

@github-actions github-actions bot added documentation Improvements or additions to documentation enhancement New feature or request dependencies Project dependencies. jobs Scenarios and jobs quality Tests, project resiliency, etc. labels Apr 18, 2024
@Guts Guts self-assigned this Apr 18, 2024
@Guts Guts force-pushed the feature/rules-add-datetime-to-context branch from 3e6a358 to e5acb78 Compare April 18, 2024 15:43
@Guts Guts marked this pull request as ready for review April 18, 2024 15:43
@Guts Guts removed documentation Improvements or additions to documentation dependencies Project dependencies. jobs Scenarios and jobs quality Tests, project resiliency, etc. labels Apr 18, 2024
@Guts Guts requested a review from florentfgrs April 18, 2024 15:44
@codecov-commenter
Copy link

codecov-commenter commented Apr 18, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 68.10%. Comparing base (1d2b672) to head (0f6f639).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #484      +/-   ##
==========================================
- Coverage   70.81%   68.10%   -2.71%     
==========================================
  Files          47       47              
  Lines        2906     2910       +4     
  Branches      631      631              
==========================================
- Hits         2058     1982      -76     
- Misses        668      747      +79     
- Partials      180      181       +1     
Flag Coverage Δ
unittests 67.83% <100.00%> (-2.44%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
...loyment_toolbelt/jobs/job_profiles_synchronizer.py 50.79% <100.00%> (ø)
..._deployment_toolbelt/utils/computer_environment.py 100.00% <100.00%> (ø)

... and 5 files with indirect coverage changes

@github-actions github-actions bot added the jobs Scenarios and jobs label Apr 18, 2024
@Guts Guts force-pushed the feature/rules-add-datetime-to-context branch from f98b01c to 2070094 Compare April 19, 2024 08:36
@Guts Guts requested a review from florentfgrs April 19, 2024 13:32
@github-actions github-actions bot added the documentation Improvements or additions to documentation label Apr 19, 2024
Copy link

sonarcloud bot commented Apr 19, 2024

Quality Gate Passed Quality Gate passed

Issues
1 New issue
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

@Guts Guts merged commit 7804ac6 into main Apr 19, 2024
25 checks passed
@Guts Guts deleted the feature/rules-add-datetime-to-context branch April 19, 2024 13:39
Guts added a commit that referenced this pull request Apr 19, 2024
In this PR we generate the rules context dynamically for the
documentation using a Sphinx hook. Then it's embedded like this:


![image](https://github.com/Guts/qgis-deployment-cli/assets/1596222/288776be-7a9a-448c-8e86-3871d9189c9f)


To merge after #484.
@Guts Guts linked an issue Apr 23, 2024 that may be closed by this pull request
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request jobs Scenarios and jobs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature Request]: add conditions on profile deployment
3 participants