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

Merge dev to main #825

Merged
merged 12 commits into from
Aug 8, 2024
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/build-bake-preview.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ jobs:
steps:
- name: Check Out main Branch
if: github.event.schedule == '0 8 * * *'
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: 'main'

Expand All @@ -104,7 +104,7 @@ jobs:

connect-daily:
needs: [versions]
name: Connect Image - Daily
name: Connect - Daily
runs-on: ubuntu-latest-4x

env:
Expand Down
88 changes: 79 additions & 9 deletions .github/workflows/build-bake.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,13 @@ jobs:

steps:
- name: Checkout
if: github.event_name == 'schedule'
uses: actions/checkout@v4
with:
ref: 'main'

- name: Checkout
if: github.event_name != 'schedule'
uses: actions/checkout@v4

- name: Get commit SHA
Expand All @@ -46,6 +53,13 @@ jobs:

steps:
- name: Checkout
if: github.event_name == 'schedule'
uses: actions/checkout@v4
with:
ref: 'main'

- name: Checkout
if: github.event_name != 'schedule'
uses: actions/checkout@v4

- name: Set up Docker Buildx
Expand All @@ -58,7 +72,7 @@ jobs:
uses: ./.github/actions/bake-test-push
with:
target: ${{ env.target }}
push-image: ${{ github.ref == 'refs/heads/main' }}
push-image: ${{ github.ref == 'refs/heads/main' || github.event_name == 'schedule' }}
ghcr-token: ${{ secrets.GITHUB_TOKEN }}
dockerhub-username: ${{ secrets.DOCKER_HUB_USERNAME }}
dockerhub-token: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
Expand All @@ -81,6 +95,13 @@ jobs:

steps:
- name: Checkout
if: github.event_name == 'schedule'
uses: actions/checkout@v4
with:
ref: 'main'

- name: Checkout
if: github.event_name != 'schedule'
uses: actions/checkout@v4

- name: Set up Docker Buildx
Expand All @@ -93,7 +114,7 @@ jobs:
uses: ./.github/actions/bake-test-push
with:
target: ${{ env.target }}
push-image: ${{ github.ref == 'refs/heads/main' }}
push-image: ${{ github.ref == 'refs/heads/main' || github.event_name == 'schedule' }}
ghcr-token: ${{ secrets.GITHUB_TOKEN }}
dockerhub-username: ${{ secrets.DOCKER_HUB_USERNAME }}
dockerhub-token: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
Expand All @@ -116,6 +137,13 @@ jobs:

steps:
- name: Checkout
if: github.event_name == 'schedule'
uses: actions/checkout@v4
with:
ref: 'main'

- name: Checkout
if: github.event_name != 'schedule'
uses: actions/checkout@v4

- name: Set up Docker Buildx
Expand All @@ -128,7 +156,7 @@ jobs:
uses: ./.github/actions/bake-test-push
with:
target: ${{ env.target }}
push-image: ${{ github.ref == 'refs/heads/main' }}
push-image: ${{ github.ref == 'refs/heads/main' || github.event_name == 'schedule' }}
ghcr-token: ${{ secrets.GITHUB_TOKEN }}
dockerhub-username: ${{ secrets.DOCKER_HUB_USERNAME }}
dockerhub-token: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
Expand All @@ -151,6 +179,13 @@ jobs:

steps:
- name: Checkout
if: github.event_name == 'schedule'
uses: actions/checkout@v4
with:
ref: 'main'

- name: Checkout
if: github.event_name != 'schedule'
uses: actions/checkout@v4

- name: Set up Docker Buildx
Expand All @@ -163,7 +198,7 @@ jobs:
uses: ./.github/actions/bake-test-push
with:
target: ${{ env.target }}
push-image: ${{ github.ref == 'refs/heads/main' }}
push-image: ${{ github.ref == 'refs/heads/main' || github.event_name == 'schedule' }}
ghcr-token: ${{ secrets.GITHUB_TOKEN }}
dockerhub-username: ${{ secrets.DOCKER_HUB_USERNAME }}
dockerhub-token: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
Expand All @@ -186,6 +221,13 @@ jobs:

steps:
- name: Checkout
if: github.event_name == 'schedule'
uses: actions/checkout@v4
with:
ref: 'main'

- name: Checkout
if: github.event_name != 'schedule'
uses: actions/checkout@v4

- name: Set up Docker Buildx
Expand All @@ -198,7 +240,7 @@ jobs:
uses: ./.github/actions/bake-test-push
with:
target: ${{ env.target }}
push-image: ${{ github.ref == 'refs/heads/main' }}
push-image: ${{ github.ref == 'refs/heads/main' || github.event_name == 'schedule' }}
ghcr-token: ${{ secrets.GITHUB_TOKEN }}
dockerhub-username: ${{ secrets.DOCKER_HUB_USERNAME }}
dockerhub-token: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
Expand All @@ -221,6 +263,13 @@ jobs:

steps:
- name: Checkout
if: github.event_name == 'schedule'
uses: actions/checkout@v4
with:
ref: 'main'

- name: Checkout
if: github.event_name != 'schedule'
uses: actions/checkout@v4

- name: Set up Docker Buildx
Expand All @@ -233,7 +282,7 @@ jobs:
uses: ./.github/actions/bake-test-push
with:
target: ${{ env.target }}
push-image: ${{ github.ref == 'refs/heads/main' }}
push-image: ${{ github.ref == 'refs/heads/main' || github.event_name == 'schedule' }}
ghcr-token: ${{ secrets.GITHUB_TOKEN }}
dockerhub-username: ${{ secrets.DOCKER_HUB_USERNAME }}
dockerhub-token: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
Expand All @@ -256,6 +305,13 @@ jobs:

steps:
- name: Checkout
if: github.event_name == 'schedule'
uses: actions/checkout@v4
with:
ref: 'main'

- name: Checkout
if: github.event_name != 'schedule'
uses: actions/checkout@v4

- name: Set up Docker Buildx
Expand All @@ -268,7 +324,7 @@ jobs:
uses: ./.github/actions/bake-test-push
with:
target: ${{ env.target }}
push-image: ${{ github.ref == 'refs/heads/main' }}
push-image: ${{ github.ref == 'refs/heads/main' || github.event_name == 'schedule' }}
ghcr-token: ${{ secrets.GITHUB_TOKEN }}
dockerhub-username: ${{ secrets.DOCKER_HUB_USERNAME }}
dockerhub-token: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
Expand All @@ -291,6 +347,13 @@ jobs:

steps:
- name: Checkout
if: github.event_name == 'schedule'
uses: actions/checkout@v4
with:
ref: 'main'

- name: Checkout
if: github.event_name != 'schedule'
uses: actions/checkout@v4

- name: Set up Docker Buildx
Expand All @@ -303,7 +366,7 @@ jobs:
uses: ./.github/actions/bake-test-push
with:
target: ${{ env.target }}
push-image: ${{ github.ref == 'refs/heads/main' }}
push-image: ${{ github.ref == 'refs/heads/main' || github.event_name == 'schedule' }}
ghcr-token: ${{ secrets.GITHUB_TOKEN }}
dockerhub-username: ${{ secrets.DOCKER_HUB_USERNAME }}
dockerhub-token: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
Expand All @@ -326,6 +389,13 @@ jobs:

steps:
- name: Checkout
if: github.event_name == 'schedule'
uses: actions/checkout@v4
with:
ref: 'main'

- name: Checkout
if: github.event_name != 'schedule'
uses: actions/checkout@v4

- name: Set up Docker Buildx
Expand All @@ -338,7 +408,7 @@ jobs:
uses: ./.github/actions/bake-test-push
with:
target: ${{ env.target }}
push-image: ${{ github.ref == 'refs/heads/main' }}
push-image: ${{ github.ref == 'refs/heads/main' || github.event_name == 'schedule' }}
ghcr-token: ${{ secrets.GITHUB_TOKEN }}
dockerhub-username: ${{ secrets.DOCKER_HUB_USERNAME }}
dockerhub-token: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
Expand Down
4 changes: 2 additions & 2 deletions docker-bake.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -461,12 +461,12 @@ target "workbench-for-google-cloud-workstations" {
tags = [
"us-central1-docker.pkg.dev/posit-images/cloud-workstations/workbench:${tag_safe_version(WORKBENCH_VERSION)}",
"us-central1-docker.pkg.dev/posit-images/cloud-workstations/workbench:latest",
"us-docker.pkg.dev/posit-images/cloud-workstations/workbench:${tag_safe_version(WORKBENCH_VERSION)}",
"us-docker.pkg.dev/posit-images/cloud-workstations/workbench:latest",
"europe-docker.pkg.dev/posit-images/cloud-workstations/workbench:${tag_safe_version(WORKBENCH_VERSION)}",
"europe-docker.pkg.dev/posit-images/cloud-workstations/workbench:latest",
"asia-docker.pkg.dev/posit-images/cloud-workstations/workbench:${tag_safe_version(WORKBENCH_VERSION)}",
"asia-docker.pkg.dev/posit-images/cloud-workstations/workbench:latest",
"us-docker.pkg.dev/posit-images/cloud-workstations/workbench:${tag_safe_version(WORKBENCH_VERSION)}",
"us-docker.pkg.dev/posit-images/cloud-workstations/workbench:latest",
]

dockerfile = "Dockerfile.${builds.os}"
Expand Down
9 changes: 6 additions & 3 deletions r-session-complete/.snyk
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ ignore:
created: 2024-07-02T20:33:30.847Z
SNYK-GOLANG-GITHUBCOMGOJOSEGOJOSEV3-6070737:
- '*':
reason: 'Reported upstream in https://github.com/rstudio/openid/issues/18'
expires: 2024-07-31T00:00:00.000Z
created: 2024-07-02T20:52:24.627Z
reason: >-
Confirmed fixed upstream in
https://github.com/rstudio/rstudio-pro/issues/6635. Patch will be
ingested in Workbench 2024.08.0 (expected within 1 week).
expires: 2024-08-07T00:00:00.000Z
created: 2024-07-31T17:46:24.852Z
patch: {}
45 changes: 44 additions & 1 deletion tools/snyk_bake_artifacts.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,15 @@
LOGGER = logging.getLogger(__name__)
SNYK_ORG = os.getenv("SNYK_ORG")
SERVICE_IMAGES = ["workbench-for-microsoft-azure=ml", "workbench-for-google-cloud-workstations"]
SARIF_PATH_FILTERS = {
"connect": ["/opt/rstudio-connect/examples"],
"workbench-for-google-cloud-workstations": [
"/usr/lib/google-cloud-sdk",
"/usr/share",
"/usr/bin",
"/usr/local/go",
],
}

PROJECT_DIR = Path(__file__).resolve().parents[1]

Expand Down Expand Up @@ -78,7 +87,8 @@ def build_snyk_command(target_name, target_spec, snyk_command, opts):
f"--file={str(docker_file_path)}",
"--platform=linux/amd64",
f"--project-name={target_spec['tags'][-1]}",
f"--sarif-file-output=container.sarif",
"--sarif-file-output=container.sarif",
"--json-file-output=container.json",
"--severity-threshold=high",
f"--policy-path={target_spec['context']}",
])
Expand Down Expand Up @@ -112,6 +122,36 @@ def build_snyk_command(target_name, target_spec, snyk_command, opts):
return cmd


def filter_sarif_file(target_spec):
with open("container.sarif", "r") as f:
c_sarif = json.load(f)
with open("container.json", "r") as f:
c_json = json.load(f)
c_sarif_paths = c_sarif["runs"]
c_sarif_root = c_sarif_paths.pop(0)
c_json_paths = c_json["applications"]
filter_paths = SARIF_PATH_FILTERS.get(target_spec["context"], [])
filtered_c_sarif_paths = [c_sarif_root]
if len(c_sarif_paths) != len(c_json_paths):
LOGGER.error("SARIF and JSON number of discovered paths do not match")
return
for i in range(len(c_sarif_paths)):
if c_json_paths[i]["dependencyCount"] != c_sarif_paths[i]["tool"]["driver"]["properties"]["artifactsScanned"]:
LOGGER.warning(
f"Artifact count in JSON, {c_json_paths[i]['dependencyCount']}, "
f"differs from artifact count in SARIF, "
f"{c_sarif_paths[i]['tool']['driver']['properties']['artifactsScanned']}, for "
f"{c_json_paths[i]['displayTargetFile']}. This may cause incorrect filtering in the SARIF file."
)
if not any(p in c_json_paths[i]["targetFile"] for p in filter_paths):
filtered_c_sarif_paths.append(c_sarif_paths[i])
c_sarif["runs"] = filtered_c_sarif_paths
num_filtered_paths = len(c_sarif_paths) - len(filtered_c_sarif_paths)
LOGGER.info(f"Filtered {num_filtered_paths} paths from SARIF file")
with open("container.sarif", "w") as f:
json.dump(c_sarif, f, indent=2)


def run_cmd(target_name, cmd):
LOGGER.info(f"Running tests for {target_name}")
LOGGER.info(f"{' '.join(cmd)}")
Expand Down Expand Up @@ -139,6 +179,9 @@ def main():
if return_code != 0:
failed_targets.append(target_name)
result = 1
if target_spec["context"] in SARIF_PATH_FILTERS and args.command == "test":
LOGGER.info("Filtering SARIF output file for excluded paths...")
filter_sarif_file(target_spec)
LOGGER.info(f"Failed targets: {failed_targets}")
exit(result)

Expand Down
15 changes: 9 additions & 6 deletions workbench-for-google-cloud-workstations/.snyk
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,15 @@ ignore:
created: 2024-07-02T20:33:30.847Z
SNYK-GOLANG-GITHUBCOMGOJOSEGOJOSEV3-6070737:
- '*':
reason: 'Reported upstream in https://github.com/rstudio/openid/issues/18'
expires: 2024-07-31T00:00:00.000Z
created: 2024-07-02T20:52:24.627Z
reason: >-
Confirmed fixed upstream in
https://github.com/rstudio/rstudio-pro/issues/6635. Patch will be
ingested in Workbench 2024.08.0 (expected within 1 week).
expires: 2024-08-07T00:00:00.000Z
created: 2024-07-31T17:46:24.852Z
SNYK-GOLANG-GOLANGORGXNETHTTP2-6531285:
- '*':
reason: 'Patched in later version https://cloud.google.com/support/bulletins#gcp-2024-023'
expires: 2024-07-31T00:00:00.000Z
created: 2024-07-03T16:16:45.000Z
reason: Vulnerability in Google Cloud SDK.
expires: 2024-09-01T00:00:00.000Z
created: 2024-07-31T19:45:25.728Z
patch: {}
9 changes: 6 additions & 3 deletions workbench-for-microsoft-azure-ml/.snyk
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ ignore:
created: 2024-07-02T20:33:30.847Z
SNYK-GOLANG-GITHUBCOMGOJOSEGOJOSEV3-6070737:
- '*':
reason: 'Reported upstream in https://github.com/rstudio/openid/issues/18'
expires: 2024-07-31T00:00:00.000Z
created: 2024-07-02T20:52:24.627Z
reason: >-
Confirmed fixed upstream in
https://github.com/rstudio/rstudio-pro/issues/6635. Patch will be
ingested in Workbench 2024.08.0 (expected within 1 week).
expires: 2024-08-07T00:00:00.000Z
created: 2024-07-31T17:46:24.852Z
patch: {}
9 changes: 6 additions & 3 deletions workbench/.snyk
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ ignore:
created: 2024-07-02T20:33:30.847Z
SNYK-GOLANG-GITHUBCOMGOJOSEGOJOSEV3-6070737:
- '*':
reason: 'Reported upstream in https://github.com/rstudio/openid/issues/18'
expires: 2024-07-31T00:00:00.000Z
created: 2024-07-02T20:52:24.627Z
reason: >-
Confirmed fixed upstream in
https://github.com/rstudio/rstudio-pro/issues/6635. Patch will be
ingested in Workbench 2024.08.0 (expected within 1 week).
expires: 2024-08-07T00:00:00.000Z
created: 2024-07-31T17:46:24.852Z
patch: {}
Loading