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

PLT-311 Add unit test workflow for opt-out-import #78

Merged
merged 0 commits into from
Jan 31, 2024

Conversation

gsf
Copy link
Member

@gsf gsf commented Jan 24, 2024

🎫 Ticket

https://jira.cms.gov/browse/PLT-311

🛠 Changes

Added workflow for running unit tests on the opt-out-import workflow.

ℹ️ Context for reviewers

This should run on every PR to check that unit tests pass.

✅ Acceptance Validation

See checks for runs. This won't be fully tested until merged and run in another PR.

🔒 Security Implications

None.

@gsf gsf requested a review from smirnovaae January 24, 2024 07:10
@gsf gsf self-assigned this Jan 24, 2024
@gsf gsf requested a review from Sadibhatla January 24, 2024 18:00
ARTIFACTORY_PASSWORD=/artifactory/password
- name: Run unit tests for opt-out-import lambda
working-directory: ./optout
run: ../gradlew test
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it possible to add sonarqube analysis after tests?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure I'll do that

Copy link
Contributor

@smirnovaae smirnovaae Jan 25, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One more question, if you don't mind
What happens if jenkins build fails and github action pass? Will I able to merge my changes?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For changes to the opt-out-import lambda, there would be no need to run the Jenkins pipeline. The GitHub Actions workflow should run automatically on PR, and the only actual gate to merge is approval from a reviewer.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sonar added but see the error in the run linked below. Is there a sonar task in the gradle build file?

https://github.com/CMSgov/ab2d-lambdas/actions/runs/7658938304/job/20872947370?pr=78#step:6:18

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no sonar task in optout lambda gradle.

There is sonarqube verification in common build.gradle under ab2d-lambdas

sonarqube {
    properties {
        property "sonar.projectKey", "ab2d-lambdas"
    }
}

and stage in jenkins

 stage('SonarQube Analysis') {
            steps {
                withCredentials([usernamePassword(credentialsId: 'artifactoryuserpass', usernameVariable: 'ARTIFACTORY_USER', passwordVariable: 'ARTIFACTORY_PASSWORD')]) {
                    // Automatically saves the an id for the SonarQube build
                    withSonarQubeEnv('CMSSonar') {
                        sh './gradlew sonarqube -Dsonar.projectKey=ab2d-lambdas -Dsonar.host.url=https://sonarqube.cloud.cms.gov'
                    }
                }
            }
        }

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So are you able to run sonar tests specifically for opt-out-import lambda in your dev environment? Which command do you run for that, and in which directory?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't run sonar from ab2d-lambda/optout. I assume, working directory should be ab2d-lambda.

Locally I've got the same result for ab2d-lambdas % ./gradlew sonar and ab2d-lambdas % ./gradlew sonarrqube.
Not sure what's the difference

I'm fine to hold off sonarqube on the current developing stage

@gsf
Copy link
Member Author

gsf commented Jan 31, 2024

Okay I've dropped SonarQube for now and checks are passing. Merging.

@gsf gsf merged this pull request into main Jan 31, 2024
1 check passed
@gsf gsf deleted the plt-311-opt-out-import-unit-test branch January 31, 2024 15:26
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.

2 participants