Skip to content

Commit

Permalink
Merge pull request #3707 from terascope/update-workflows-and-kafka-te…
Browse files Browse the repository at this point in the history
…st-version

Update workflows and kafka test version
  • Loading branch information
jsnoble committed Jul 31, 2024
2 parents 6792a38 + 8d393a1 commit b53af0c
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 256 deletions.
85 changes: 3 additions & 82 deletions .github/workflows/daily-docker-cache.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,85 +6,6 @@ on:
workflow_dispatch:

jobs:
cache-docker-images:
runs-on: ubuntu-latest

# # final check to make sure it runs only on master branch
if: github.ref == 'refs/heads/master'

steps:
- name: Check out code
uses: actions/checkout@v4

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 18
cache: 'yarn'

# we login to docker to avoid docker pull limit rates
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Check docker.hub limit start of job
env:
USER: ${{ secrets.DOCKER_USERNAME }}
PASS: ${{ secrets.DOCKER_PASSWORD }}
run: yarn docker:limit

- name: Install and build packages
run: yarn setup
env:
YARN_SETUP_ARGS: "--prod=false --silent"

- name: Create Docker Image List
run: |
yarn docker:listImages
cat ./images/image-list.txt
- name: Restore Docker image cache
id: docker-cache
uses: actions/cache@v4
with:
path: /tmp/docker_cache
key: docker-images-${{ hashFiles('./images/image-list.txt') }}
lookup-only: true

- name: Clear old docker cache
if: ${{steps.docker-cache.outputs.cache-hit == 'true'}}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPO: ${{ github.repository }}
BRANCH: refs/heads/master
run: |
gh extension install actions/gh-actions-cache
echo "Fetching list of cache key"
cacheKeysForPR=$(gh actions-cache list --key "docker-images-" -R $REPO -B $BRANCH -L 100 | cut -f 1 )
## Setting this to not fail the workflow while deleting cache keys.
set +e
echo "Deleting caches..."
for cacheKey in $cacheKeysForPR
do
gh actions-cache delete $cacheKey -R $REPO -B $BRANCH --confirm
done
echo "Done"
- name: Pull and save Docker images
run: yarn docker:saveImages

- name: Update Docker image cache
uses: actions/cache/save@v4
with:
path: /tmp/docker_cache
key: docker-images-${{ hashFiles('./images/image-list.txt') }}

- name: Check docker.hub limit end of job
env:
USER: ${{ secrets.DOCKER_USERNAME }}
PASS: ${{ secrets.DOCKER_PASSWORD }}
run: npm run docker:limit
call-refresh-docker-cache-workflow:
uses: terascope/workflows/.github/workflows/refresh-docker-cache.yml@f5e098fa861fe7744fa61842e82124f806364be9
secrets: inherit
Loading

0 comments on commit b53af0c

Please sign in to comment.