Skip to content

Commit

Permalink
Move jira-issue-lottery.config-file-repo value from application.prope…
Browse files Browse the repository at this point in the history
…rties to .env file and set a default for testing.
  • Loading branch information
xjusko committed Feb 26, 2024
1 parent 7f36851 commit 2c11173
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 8 deletions.
22 changes: 18 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,13 @@ Fork this repository to your GitHub account.
- project: ELY
components: [HTTP, Core]
maxIssues: 3
availableProjects:
WFLY:
- Logging
- JMS
ELY:
- HTTP
- Core
```
`delay`::
The duration of the lottery cycle before participants are selected again.
Expand Down Expand Up @@ -52,16 +59,23 @@ Fork this repository to your GitHub account.
The maximum number of issues the participant is willing to take for the specified project and components.
+ Integer, mandatory, no default.

`availableProjects`::
A dictionary specifying the available JIRA projects and their components. Participants use this information to make their preferences in the `projects` section.
+ Dictionary, mandatory, no default.



2. Commit and push the changes to your forked repository.

### Configure Application Properties
1. Change the value of `jira-issue-lottery.config-file-repo` in the `application.properties` file to point to a public repository with a valid config file according to first step in [Configuration section](#configure-jira-lottery) such as `https://github.com/jboss-set/jira-issue-lottery`.

### Create .env File
1. Create a `.env` file in the main directory of your app.
2. Create a Jira Personal Access Token ([Guide on how to create the token](https://confluence.atlassian.com/enterprise/using-personal-access-tokens-1026032365.html))
3. Add the following variable to the `.env` file:
2. Add the value of `%dev.jira-issue-lottery.config-file-repo` in the `.env` file to point to a public repository with a valid config file according to first step in [Configuration section](#configure-jira-lottery) such as `https://github.com/jboss-set/jira-issue-lottery`.
```env
%dev.jira-issue-lottery.config-file-repo=<YOUR REPOSITORY URL>
> **NOTE** This will override the default value specified in `application.properties` file. If you override the value for all modes (dev, test, prod, when you don't prepend a mode, such as `%dev`), then one of the tests will fail, as it expects the original value.
3. Create a Jira Personal Access Token ([Guide on how to create the token](https://confluence.atlassian.com/enterprise/using-personal-access-tokens-1026032365.html))
4. Add the following variable to the `.env` file:
```env
jira-issue-lottery.access-token=<YOUR TOKEN>
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/application.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
camel.component.jira.jira-url=https://issues.redhat.com/
%test.jira-issue-lottery.access-token=ignored
jira-issue-lottery.config-file-repo=https://github.com/The-Huginn/jira-issue-lottery
jira-issue-lottery.config-file-repo=https://github.com/jboss-set/jira-issue-lottery
quarkus.kubernetes.deployment-kind=cron-job
# Cron expression to run the job every Monday see https://kubernetes.io/docs/concepts/workloads/controllers/cron-jobs/#writing-a-cronjob-spec
quarkus.kubernetes.cron-job.schedule=* * * * 1
Expand Down
8 changes: 5 additions & 3 deletions src/test/java/org/jboss/set/draw/LotteryDrawingTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -289,9 +289,11 @@ public void testAppendingRepositoryForUnsubcription() throws Exception {

List<Mail> sent = mailbox.getMailsSentTo(email);
assertEquals(1, sent.size());
// Check directly for this URL as we know it is valid one. Using templates might result in a corrupted URL overall
assertTrue(sent.get(0).getText()
.contains("https://github.com/The-Huginn/jira-issue-lottery/blob/main/.github/jira-issue-lottery.yml"));
String emailText = sent.get(0).getText();

//Checks only if email message is correctly formatted. The URL is only for test purpose and may be invalid.
String expectedUrl = "https://github.com/jboss-set/jira-issue-lottery/blob/main/.github/jira-issue-lottery.yml";
assertTrue(emailText.contains(expectedUrl));
}

@Test
Expand Down

0 comments on commit 2c11173

Please sign in to comment.