Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
14 changes: 11 additions & 3 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ on:
jobs:
publish:
runs-on: ubuntu-26.04
permissions:
contents: read
id-token: write
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
Expand All @@ -29,7 +32,12 @@ jobs:
with:
platforms: arm64

- run: ./docker/batch-change-volume-workspace/push.py -d ./docker/batch-change-volume-workspace/Dockerfile -i sourcegraph/src-batch-change-volume-workspace -p linux/amd64,linux/arm64,linux/386 --readme ./docker/batch-change-volume-workspace/README.md
- name: Login to Docker Hub
uses: docker/login-action@8aa5831fb8d48d8f76594c7ddde61ae58019f550 # v4.8.0
with:
username: sourcegraph
scope: sourcegraph/src-batch-change-volume-workspace
env:
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKERHUB_OIDC_CONNECTIONID: 9f14c248-6ae5-4c2a-ad0c-3af4ca55a16e

- run: ./docker/batch-change-volume-workspace/push.py -d ./docker/batch-change-volume-workspace/Dockerfile -i sourcegraph/src-batch-change-volume-workspace -p linux/amd64,linux/arm64,linux/386 --readme ./docker/batch-change-volume-workspace/README.md
13 changes: 9 additions & 4 deletions .github/workflows/goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,9 @@ jobs:
name: Run goreleaser
runs-on: ubuntu-latest
needs: [release_type, goreleaser_pre]
permissions:
contents: read
id-token: write
# By default, this job will be skipped if either "needs" job is skipped. This tells
# GitHub actions to always run it, so long as the previous jobs that ran didn't fail.
if: |
Expand Down Expand Up @@ -178,15 +181,17 @@ jobs:
id: mise
run: echo "go-version=$(grep 'golang' mise.toml | cut -d'"' -f2)" >> $GITHUB_OUTPUT
- name: Set up Go
uses: sourcegraph/actions/go-setup@4430dc1e4dde002387a4b655b41f6431ca75b1c1 # main
uses: sourcegraph/actions/go-setup@4c889fc8e48c06d4bbcb42a4b3a4965c2a83dccb # main
with:
go-version: ${{ steps.mise.outputs.go-version }}
- run: go test ./...
- run: go test -race -v ./...
- run: echo "${DOCKER_PASSWORD}" | docker login -u=$DOCKER_USERNAME --password-stdin
- name: Login to Docker Hub
uses: docker/login-action@8aa5831fb8d48d8f76594c7ddde61ae58019f550 # v4.8.0
with:
username: sourcegraph
env:
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKERHUB_OIDC_CONNECTIONID: 9f14c248-6ae5-4c2a-ad0c-3af4ca55a16e
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@a4f02ab5355a589de60d917a659ce617ed19b3de # v7.3.0
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/scip.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
id: mise
run: echo "go-version=$(grep 'golang' mise.toml | cut -d'"' -f2)" >> $GITHUB_OUTPUT
- name: Set up Go
uses: sourcegraph/actions/go-setup@4430dc1e4dde002387a4b655b41f6431ca75b1c1 # main
uses: sourcegraph/actions/go-setup@4c889fc8e48c06d4bbcb42a4b3a4965c2a83dccb # main
with:
go-version: ${{ steps.mise.outputs.go-version }}

Expand Down
17 changes: 2 additions & 15 deletions docker/batch-change-volume-workspace/push.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
# This is a very simple script to build and push the Docker image used by the
# Docker volume workspace driver. It's normally run from the "Publish Docker
# image dependencies" GitHub Action, but can be run locally if necessary.
# It reuses Docker's existing authentication, set up by the workflow's OIDC
# login or by running docker login locally.
#
# This script requires Python 3.8 or later, and Docker 19.03 (for buildx). You
# are strongly encouraged to use Black to format this file after modifying it.
Expand Down Expand Up @@ -87,14 +89,6 @@ def docker_cli_build(
run(args, stdin=dockerfile)


def docker_cli_login(username: str, password: str):
run(
["docker", "login", f"-u={username}", "--password-stdin"],
input=password,
text=True,
)


def run(args: Sequence[str], /, **kwargs) -> subprocess.CompletedProcess:
print(f"+ {' '.join(args)}")
return subprocess.run(args, check=True, **kwargs)
Expand Down Expand Up @@ -127,13 +121,6 @@ def main():
tags = calculate_tags(args.ref)
print(f"will push tags: {', '.join(tags)}")

print("logging into Docker Hub")
try:
docker_cli_login(os.environ["DOCKER_USERNAME"], os.environ["DOCKER_PASSWORD"])
except KeyError as e:
print(f"error retrieving environment variables: {e}")
raise

print("building and pushing image")
docker_cli_build(open(args.dockerfile, "rb"), args.platform, args.image, tags)

Expand Down
Loading