Skip to content

Instantly share code, notes, and snippets.

@mrnugget
Created February 12, 2021 11:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mrnugget/4058323ad783a683d82a4c9790f98462 to your computer and use it in GitHub Desktop.
Save mrnugget/4058323ad783a683d82a4c9790f98462 to your computer and use it in GitHub Desktop.
Sourcegraph campaign to change Docker Hub username in Circle CI configuration
name: update-circle-ci-docker-user.campaign.yaml
description: Changes the Docker Hub username used for Circle CI
# Search for repositories containing a circle-ci.yml file with the old usename
on:
- repositoriesMatchingQuery: mydockerhub-user file:circle-ci.[yaml|yml]
# In each repository
steps:
# replace the old with the new username in the found files
- run: |
for file in "${{ join repository.search_result_paths " " }}";
do
sed -i 's/mydockerhub-user/ci-dockerhub-user/g;' ${file}
done
container: alpine:3
# Describe the changeset (e.g., GitHub pull request) you want for each repository.
changesetTemplate:
title: Use new Docker Hub username in Circle CI config
body: This change replaces the old Docker Hub user with the new, CI specific user account.
branch: campaigns/update-ci-user # Push the commit to this branch.
commit:
message: Update Docker Hub user in CI
published: false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment