Skip to content

Commit

Permalink
Fix CI workflows: continuous-integration.yml (#3815)
Browse files Browse the repository at this point in the history
### **PR Description**

This PR addresses the issue of the failing
[continuous-integration](https://github.com/department-of-veterans-affairs/abd-vro/blob/5fd9d352ea2e5f8d2a341669cafd1cb18b6bdd5e/.github/workflows/continuous-integration.yml#L1-L74)
workflow in the `abd-vro-internal` repository.

#### **Background**
The continuous-integration workflow has been failing for months, and
there is no record of a successful run in the `abd-vro-internal`
repository. ([See workflow run
history](https://github.com/department-of-veterans-affairs/abd-vro-internal/actions/workflows/continuous-integration.yml)).


![image](https://github.com/user-attachments/assets/c9540c9b-83df-41f4-876e-bddfec4ef8e8)


#### **Root Cause**
The likely cause of the failures is the absence of the
`ACCESS_TOKEN_CHECKOUT_INTERNAL_REPO` secret in `abd-vro-internal`.
([See missing secret in repository
settings](https://github.com/department-of-veterans-affairs/abd-vro-internal/settings/secrets/actions)).
This variable is used in the workflow and is needed for checking out
dependencies from the internal repository. ([See usage in
workflow](https://github.com/department-of-veterans-affairs/abd-vro/blob/b046987e9c6cf8babef566cef31d87161ef51219/.github/workflows/ee-ep-merge-end-to-end.yml#L13-L27)).

#### **Rationale**
The `abd-vro-internal` CI workflow fails consistently due to this
misconfiguration and doesn’t provide additional insights beyond what is
already available in the `abd-vro` repository. Running the same workflow
in both repositories introduces risks of:
- **Misconfigurations:** Variables or settings missing in one
repository.
- **De-synchronization:** Potential for the two workflows to become out
of sync over time.
- **Redundancy:** Duplicate workflows without added value.

Since the CI workflow passes successfully in `abd-vro` and only fails in
`abd-vro-internal` due to Git-related issues, the `abd-vro-internal`
runs do not offer meaningful insight or benefit.

#### **Solution**
This PR limits the execution of the CI workflow to the `abd-vro`
repository by adding a conditional check:
```yaml
if: github.repository == 'department-of-veterans-affairs/abd-vro'
```

This ensures that CI runs are limited to the `abd-vro` repository, where
the workflow is properly configured, avoiding redundant failures in
`abd-vro-internal`.

#### **How to Test**
1. Verify that the CI workflow in `abd-vro` executes successfully.
2. Confirm that the CI workflow does not run in the `abd-vro-internal`
repository.

Errata:
```
Checkout abd-vro-dev-secrets repo
Determining the default branch
  Retrieving the default branch name
  Not Found - https://docs.github.com/rest/repos/repos#get-a-repository
  Waiting 10 seconds before trying again
  Retrieving the default branch name
  Not Found - https://docs.github.com/rest/repos/repos#get-a-repository
  Waiting 10 seconds before trying again
  Retrieving the default branch name
  Error: Not Found - https://docs.github.com/rest/repos/repos#get-a-repository
```

```
* What went wrong:
A problem occurred configuring root project 'abd_vro'.
> Could not resolve all artifacts for configuration ':classpath'.
   > Could not resolve org.springframework.boot:spring-boot-gradle-plugin:3.3.3.
     Required by:
         root project : > org.springframework.boot:org.springframework.boot.gradle.plugin:3.3.3
      > Dependency requires at least JVM runtime version 17. This build uses a Java 11 JVM.
   > Could not resolve org.springframework.boot:spring-boot-gradle-plugin:2.7.14.
     Required by:
         root project : > project :gradle-plugins > org.springdoc.openapi-gradle-plugin:org.springdoc.openapi-gradle-plugin.gradle.plugin:1.8.0 > org.springdoc:springdoc-openapi-gradle-plugin:1.8.0
      > Dependency requires at least JVM runtime version 17. This build uses a Java 11 JVM.

* Try:
> Run this build using a Java 17 or newer JVM.
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.

BUILD FAILED in 1m
Error: Process completed with exit code 1.
```
  • Loading branch information
gabezurita authored Dec 3, 2024
2 parents 7151d26 + 5fd9d35 commit 18fba93
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,36 +19,40 @@ concurrency:

jobs:
nondraft-pr:
# Adding an `if:` that evaluates to false for this nondraft-pr job prevents other dependent jobs from running.
# For github.event.pull_request fields, see
# https://docs.github.com/en/webhooks-and-events/webhooks/webhook-events-and-payloads#pull_request
if: github.event_name != 'pull_request' ||
(github.event_name == 'pull_request' && !github.event.pull_request.draft )
if: >
github.repository == 'department-of-veterans-affairs/abd-vro' &&
(github.event_name != 'pull_request' ||
(github.event_name == 'pull_request' && !github.event.pull_request.draft))
runs-on: ubuntu-latest
steps:
- name: "DEBUG"
run: |
echo "${{ github.event_name }} ${{ github.event.pull_request.draft }}"
lint-and-test:
if: github.repository == 'department-of-veterans-affairs/abd-vro'
uses: ./.github/workflows/test-code.yml
secrets: inherit

codeql:
if: github.repository == 'department-of-veterans-affairs/abd-vro'
uses: ./.github/workflows/codeql-analysis.yml
secrets: inherit

container-healthchecks:
if: github.repository == 'department-of-veterans-affairs/abd-vro'
needs: nondraft-pr
uses: ./.github/workflows/container-healthchecks.yml
secrets: inherit

svc-bgs-api:
if: github.repository == 'department-of-veterans-affairs/abd-vro'
needs: nondraft-pr
uses: ./.github/workflows/svc-bgs-api-integration-test.yml
secrets: inherit

svc-bip-api:
if: github.repository == 'department-of-veterans-affairs/abd-vro'
needs: nondraft-pr
uses: ./.github/workflows/svc-bip-api-integration-test.yml
secrets: inherit
Expand All @@ -58,11 +62,13 @@ jobs:
# - Disabling issue: https://github.com/department-of-veterans-affairs/abd-vro/issues/3802
# - BIE Docs: https://github.com/department-of-veterans-affairs/abd-vro/issues/3753
# svc-bie-kafka-end-to-end:
# if: github.repository == 'department-of-veterans-affairs/abd-vro'
# needs: nondraft-pr
# uses: ./.github/workflows/bie-kafka-end2end-test.yml
# secrets: inherit

ee-ep-merge-end-to-end:
if: github.repository == 'department-of-veterans-affairs/abd-vro'
needs: nondraft-pr
uses: ./.github/workflows/ee-ep-merge-end-to-end.yml
secrets: inherit

0 comments on commit 18fba93

Please sign in to comment.