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

feat: add image variant with vscode specific settings #314

Merged
merged 23 commits into from
Feb 20, 2024
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
60fb097
feat: add image variant with vscode specific settings
rjaegers Feb 17, 2024
108a375
chore: fix sign command for vscode container
rjaegers Feb 17, 2024
cf595ee
chore(devcontainer.json): remove unnecessary properties for this cont…
rjaegers Feb 17, 2024
35b27f0
chore: externalize metadata and extend contents
rjaegers Feb 17, 2024
658b65b
ci: add checkout step to build-push
rjaegers Feb 17, 2024
a4e6212
chore: quote label data
rjaegers Feb 17, 2024
fd99d7e
chore: simplify devcontainer-metadata-vscode.json
rjaegers Feb 17, 2024
72f42ae
chore: add back one extension
rjaegers Feb 18, 2024
dbc18a8
chore: add more plug-ins
rjaegers Feb 18, 2024
194f1a7
chore: try to fix array escaping
rjaegers Feb 18, 2024
5ecad2e
chore: use jq tostring to convert json to label
rjaegers Feb 18, 2024
6985e5c
chore: debug json magic
rjaegers Feb 18, 2024
32797e3
chore: escape, quote, unescape, doule escape... for victory
rjaegers Feb 18, 2024
13fa2f0
chore: hard-code metadata for now, I give up
rjaegers Feb 18, 2024
7f075ec
chore: single quote content of label to prevent shell interpolation
rjaegers Feb 18, 2024
70ed217
chore: running out of ideas
rjaegers Feb 18, 2024
74564e7
chore: why can't you leave my quotes alone
rjaegers Feb 18, 2024
8e18d40
ci: final victory
rjaegers Feb 18, 2024
13c26ea
chore: add vscode settings
rjaegers Feb 18, 2024
4c5e4a8
chore: change path to compile_commands
rjaegers Feb 19, 2024
cf3f104
chore: update vscode plugin versions
rjaegers Feb 20, 2024
92a64f0
chore: update documentation
rjaegers Feb 20, 2024
562ce60
docs: minor update on merge logic for devcontainer.metadata
rjaegers Feb 20, 2024
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
12 changes: 12 additions & 0 deletions .devcontainer/devcontainer-metadata-vscode.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[
{
"remoteEnv": { "LOCAL_WORKSPACE_FOLDER": "${localWorkspaceFolder}" },
"customizations": {
"vscode": {
"extensions": [
"[email protected]"
]
rjaegers marked this conversation as resolved.
Show resolved Hide resolved
}
}
}
]
2 changes: 0 additions & 2 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
"dockerfile": "Dockerfile",
"context": ".."
},
"runArgs": ["--add-host=host.docker.internal:host-gateway"],
"remoteEnv": { "LOCAL_WORKSPACE_FOLDER": "${localWorkspaceFolder}" },
"mounts": [
"source=/var/run/docker.sock,target=/var/run/docker.sock,type=bind"
],
Expand Down
74 changes: 55 additions & 19 deletions .github/workflows/build-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,23 @@ jobs:
# with sigstore/fulcio when running outside of PRs.
id-token: write
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
persist-credentials: false
- uses: sigstore/cosign-installer@e1523de7571e31dbe865fd2e80c5c7c23ae71eb4 # v3.4.0
if: ${{ github.event_name != 'merge_group' }}
- uses: docker/setup-qemu-action@68827325e0b33c7199eb31dd4e31fbe9023e06e3 # v3.0.0
- uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0
with:
version: v0.12.1
- uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0
if: ${{ github.event_name != 'merge_group' }}
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81 # v5.5.1
id: meta
id: metadata-base
env:
DOCKER_METADATA_ANNOTATIONS_LEVELS: manifest,index
with:
Expand All @@ -45,43 +58,66 @@ jobs:
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
- uses: docker/setup-qemu-action@68827325e0b33c7199eb31dd4e31fbe9023e06e3 # v3.0.0
- uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0
- uses: docker/build-push-action@4a13e500e55cf31b7a5d59a38ab2040ab0f42f56 # v5.1.0
id: build-and-push-base
with:
version: v0.12.0
- uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0
if: ${{ github.event_name != 'merge_group' }}
file: .devcontainer/Dockerfile
platforms: linux/amd64,linux/arm64
push: ${{ github.event_name != 'merge_group' }}
tags: ${{ steps.metadata-base.outputs.tags }}
labels: ${{ steps.metadata-base.outputs.labels }}
annotations: ${{ steps.metadata-base.outputs.annotations }}
sbom: true
provenance: true
cache-from: type=gha
cache-to: type=gha,mode=max
- uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81 # v5.5.1
id: metadata-vscode
env:
DOCKER_METADATA_ANNOTATIONS_LEVELS: manifest,index
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
images: ${{ env.REGISTRY }}/${{ github.repository }}-vscode
# Generate Docker tags based on the following events/attributes
tags: |
type=raw,value=latest,enable={{is_default_branch}}
type=ref,event=pr
type=semver,pattern={{raw}}
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
- run: echo "metadata=$(jq -cj '.' .devcontainer/devcontainer-metadata-vscode.json)" >> "$GITHUB_OUTPUT"
id: devcontainer-metadata
- uses: docker/build-push-action@4a13e500e55cf31b7a5d59a38ab2040ab0f42f56 # v5.1.0
id: build-and-push
id: build-and-push-vscode
with:
file: .devcontainer/Dockerfile
platforms: linux/amd64,linux/arm64
push: ${{ github.event_name != 'merge_group' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
annotations: ${{ steps.meta.outputs.annotations }}
tags: ${{ steps.metadata-vscode.outputs.tags }}
labels: |
${{ steps.metadata-vscode.outputs.labels }}
devcontainer.metadata=${{ steps.devcontainer-metadata.outputs.metadata }}
annotations: ${{ steps.metadata-vscode.outputs.annotations }}
sbom: true
provenance: true
cache-from: type=gha
cache-to: type=gha,mode=max
- uses: anchore/sbom-action@b6a39da80722a2cb0ef5d197531764a89b5d48c3 # v0.15.8
if: ${{ steps.build-and-push.outputs.digest != '' && github.event_name != 'merge_group' }}
if: ${{ steps.build-and-push-base.outputs.digest != '' && github.event_name != 'merge_group' }}
with:
image: ${{ env.REGISTRY }}/${{ github.repository }}@${{ steps.build-and-push.outputs.digest }}
image: ${{ env.REGISTRY }}/${{ github.repository }}@${{ steps.build-and-push-base.outputs.digest }}
dependency-snapshot: true
- uses: actions/dependency-review-action@80f10bf419f34980065523f5efca7ebed17576aa # v4.1.0
if: ${{ github.event_name == 'pull_request' }}
with:
comment-summary-in-pr: on-failure
fail-on-severity: critical
- name: Sign the image with GitHub OIDC token
- name: Sign the images with GitHub OIDC token
if: ${{ github.event_name != 'merge_group' }}
# This step uses the GitHub OIDC identity token to provision an ephemeral certificate
# against the sigstore community Fulcio instance.
env:
DIGEST: ${{ steps.build-and-push.outputs.digest }}
run: cosign sign --yes --recursive "${{ env.REGISTRY }}/${{ github.repository }}@${DIGEST}"
DIGEST_BASE: ${{ steps.build-and-push-base.outputs.digest }}
DIGEST_VSCODE: ${{ steps.build-and-push-vscode.outputs.digest }}
run: |
cosign sign --yes --recursive "${{ env.REGISTRY }}/${{ github.repository }}@${DIGEST_BASE}"
cosign sign --yes --recursive "${{ env.REGISTRY }}/${{ github.repository }}-vscode@${DIGEST_VSCODE}"
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ jobs:
# While the docker/build-push-action works from the Git context, we still need
# the checkout step for running our tests.
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
persist-credentials: false
- uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0
- uses: docker/build-push-action@4a13e500e55cf31b7a5d59a38ab2040ab0f42f56 # v5.1.0
with:
Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/cleanup-pr-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,16 @@ jobs:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- run: cosign clean -f --type=signature "${{ env.REGISTRY }}/${{ github.repository }}:pr-${{ github.event.pull_request.number }}"
- run: cosign clean -f --type=signature "${{ env.REGISTRY }}/${{ github.repository }}-vscode:pr-${{ github.event.pull_request.number }}"
- uses: bots-house/ghcr-delete-image-action@3827559c68cb4dcdf54d813ea9853be6d468d3a4 # v1.1.0
with:
owner: ${{ github.repository_owner }}
name: ${{ github.event.repository.name }}
token: ${{ secrets.GITHUB_TOKEN }}
tag: pr-${{ github.event.pull_request.number }}
- uses: bots-house/ghcr-delete-image-action@3827559c68cb4dcdf54d813ea9853be6d468d3a4 # v1.1.0
with:
owner: ${{ github.repository_owner }}
name: ${{ github.event.repository.name }}-vscode
token: ${{ secrets.GITHUB_TOKEN }}
tag: pr-${{ github.event.pull_request.number }}