Skip to content

Commit

Permalink
ci(sage-monorepo): fix how env vars are passed to the dev container (#…
Browse files Browse the repository at this point in the history
…2459)

* Touch two projects with scanner

* Pass env var to CI

* Add SONAR_PULL_REQUEST_NUMBER to dev container definition
  • Loading branch information
tschaffter authored Jan 26, 2024
1 parent 19352e8 commit 34d3b2e
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 16 deletions.
56 changes: 44 additions & 12 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"name": "Sage Dev Container",
"image": "ghcr.io/sage-bionetworks/sage-devcontainer:be08406",

"containerEnv": {
"NX_BASE": "${localEnv:NX_BASE}",
"NX_BRANCH": "${localEnv:NX_BRANCH}",
Expand All @@ -11,20 +10,21 @@
"NX_HEAD": "${localEnv:NX_HEAD}",
"NX_RUN_GROUP": "${localEnv:NX_RUN_GROUP}",
"SONAR_TOKEN": "${localEnv:SONAR_TOKEN}",
"SONAR_PULL_REQUEST_NUMBER": "${localEnv:SONAR_PULL_REQUEST_NUMBER}",
"DOCKER_USERNAME": "${localEnv:DOCKER_USERNAME}",
"DOCKER_PASSWORD": "${localEnv:DOCKER_PASSWORD}"
},

"features": {
"ghcr.io/devcontainers/features/docker-in-docker:2.4.0": {
"version": "24.0.5",
"moby": false
}
},

"customizations": {
"codespaces": {
"openFiles": ["README.md"]
"openFiles": [
"README.md"
]
},
"vscode": {
"extensions": [
Expand Down Expand Up @@ -66,13 +66,43 @@
}
}
},

"forwardPorts": [
2432, 3000, 3306, 4200, 4211, 5017, 5200, 5432, 5601, 7010, 7080, 7200, 7888, 8010, 8071, 8000,
8080, 8081, 8082, 8083, 8084, 8085, 8086, 8090, 8091, 8092, 8200, 8787, 8888, 8889, 9090, 9104,
9200, 9411, 27017
2432,
3000,
3306,
4200,
4211,
5017,
5200,
5432,
5601,
7010,
7080,
7200,
7888,
8010,
8071,
8000,
8080,
8081,
8082,
8083,
8084,
8085,
8086,
8090,
8091,
8092,
8200,
8787,
8888,
8889,
9090,
9104,
9200,
9411,
27017
],

"portsAttributes": {
"2432": {
"label": "itlas-postgres",
Expand Down Expand Up @@ -219,8 +249,10 @@
"onAutoForward": "silent"
}
},

"remoteUser": "vscode",
"shutdownAction": "stopContainer",
"runArgs": ["--name", "sage_devcontainer"]
}
"runArgs": [
"--name",
"sage_devcontainer"
]
}
6 changes: 3 additions & 3 deletions .github/workflows/sonar-scan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ jobs:
uses: nrwl/nx-set-shas@v3

- name: Set up the dev container
uses: ./.github/actions/setup-dev-container

- name: Scan the affected projects with Sonar
env:
SONAR_PULL_REQUEST_NUMBER: ${{ github.event.pull_request.number }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
uses: ./.github/actions/setup-dev-container

- name: Scan the affected projects with Sonar
run: |
devcontainer exec --workspace-folder ../sage-monorepo bash -c ". ./dev-env.sh \
&& nx affected --target=sonar"
1 change: 0 additions & 1 deletion apps/openchallenges/app/src/app/app.component.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<openchallenges-google-tag-manager *ngIf="useGoogleTagManager" />
<!-- XXX -->
<openchallenges-navbar
class="mat-elevation-z6"
[title]="title"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.ComponentScan;

// XXX to trigger Sonar scan
@ComponentScan(basePackages = {"org.sagebionetworks.openchallenges"})
@EnableEurekaClient
@EnableFeignClients
Expand Down

0 comments on commit 34d3b2e

Please sign in to comment.