Skip to content

Commit

Permalink
Testing artifacts and registry
Browse files Browse the repository at this point in the history
  • Loading branch information
tanner-ricks committed Nov 21, 2024
1 parent 3048010 commit 7e7fa14
Show file tree
Hide file tree
Showing 2 changed files with 123 additions and 40 deletions.
52 changes: 52 additions & 0 deletions .github/actions/build-image/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: 'Build Image'
description: 'Builds and syncs image to registry'
inputs:
rootDir:
description: 'The root directory which contains the dockerfile'
required: false
default: ./
localImage:
description: 'The name of the local image'
required: true
localTag:
description: 'The tag of the local image'
required: false
default: latest
remoteImage:
description: 'The name of the remote image'
required: true
remoteTag:
description: 'The tag of the remote image'
required: false
default: latest

runs:
using: "composite"
steps:
- run: |
cd ${{ inputs.rootDir }}
set +e
docker pull ${{ inputs.remoteImage }}:${{ inputs.remoteTag }} 2>/dev/null
premotecode="$?"
if [[ "$premotecode" == "0" ]]; then
docker image tag ${{ inputs.remoteImage }}:${{ inputs.remoteTag }} ${{ inputs.localImage }}:${{ inputs.localTag }} 2>/dev/null
tremotecode="$?"
fi
docker build -t ${{ inputs.localImage }}:${{ inputs.localTag }} .
blocalcode="$?"
if [[ "$blocalcode" != "0" ]]; then
echo "exitcode=$blocalcode" >> $GITHUB_OUTPUT
exit "$blocalcode"
fi
docker image tag ${{ inputs.localImage }}:${{ inputs.localTag }} ${{ inputs.remoteImage }}:${{ inputs.remoteTag }} 2>/dev/null
tlocalcode="$?"
if [[ "$tlocalcode" == "0" ]]; then
docker image push ${{ inputs.remoteImage }}:${{ inputs.remoteTag }} 2>/dev/null
plocalcode="$?"
else
exit "tlocalcode"
fi
if [[ "$plocalcode" != "0" ]]; then
exit "$plocalcode"
fi
shell: bash
111 changes: 71 additions & 40 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -115,50 +115,81 @@ jobs:

# Build and sync images
- name: Build Frontend
run: |
cd sbl-frontend
docker pull ghcr.io/cfpb/regtech/sbl/sbl-frontend:${GITHUB_HEAD_REF:latest} 2>/dev/null
docker image tag ghcr.io/cfpb/regtech/sbl/sbl-frontend:${GITHUB_HEAD_REF:latest} sbl-project-sbl-frontend:latest 2>/dev/null
docker build -t sbl-project-sbl-frontend .
docker image tag sbl-project-sbl-frontend:latest ghcr.io/cfpb/regtech/sbl/sbl-frontend:${GITHUB_HEAD_REF:latest} 2>/dev/null
docker image push ghcr.io/cfpb/regtech/sbl/sbl-frontend:${GITHUB_HEAD_REF:latest} 2>/dev/null
exit 0
uses: ./sbl-frontend/.github/actions/build-image
with:
rootDir: sbl-frontend
localImage: sbl-project-sbl-frontend
remoteImage: ghcr.io/cfpb/regtech/sbl/sbl-frontend
remoteTag: ${GITHUB_HEAD_REF:latest}
# run: |
# cd sbl-frontend
# set +e
# docker pull ghcr.io/cfpb/regtech/sbl/sbl-frontend:${GITHUB_HEAD_REF:latest} 2>/dev/null
# docker image tag ghcr.io/cfpb/regtech/sbl/sbl-frontend:${GITHUB_HEAD_REF:latest} sbl-project-sbl-frontend:latest 2>/dev/null
# docker build -t sbl-project-sbl-frontend .
# docker image tag sbl-project-sbl-frontend:latest ghcr.io/cfpb/regtech/sbl/sbl-frontend:${GITHUB_HEAD_REF:latest} 2>/dev/null
# docker image push ghcr.io/cfpb/regtech/sbl/sbl-frontend:${GITHUB_HEAD_REF:latest} 2>/dev/null
# exit 0
- name: Build Cleanup API
run: |
cd regtech-cleanup-api
docker pull ghcr.io/cfpb/regtech/sbl/regtech-cleanup-api:latest 2>/dev/null
docker image tag ghcr.io/cfpb/regtech/sbl/regtech-cleanup-api:latest sbl-project-cleanup:latest 2>/dev/null
docker build -t sbl-project-cleanup .
docker image tag sbl-project-cleanup:latest ghcr.io/cfpb/regtech/sbl/regtech-cleanup-api:latest 2>/dev/null
docker image push ghcr.io/cfpb/regtech/sbl/regtech-cleanup-api:latest 2>/dev/null
exit 0
uses: ./sbl-frontend/.github/actions/build-image
with:
rootDir: regtech-cleanup-api
localImage: sbl-project-cleanup
remoteImage: ghcr.io/cfpb/regtech/sbl/regtech-cleanup-api
# run: |
# set +e
# cd regtech-cleanup-api
# docker pull ghcr.io/cfpb/regtech/sbl/regtech-cleanup-api:latest 2>/dev/null
# docker image tag ghcr.io/cfpb/regtech/sbl/regtech-cleanup-api:latest sbl-project-cleanup:latest 2>/dev/null
# docker build -t sbl-project-cleanup .
# docker image tag sbl-project-cleanup:latest ghcr.io/cfpb/regtech/sbl/regtech-cleanup-api:latest 2>/dev/null
# docker image push ghcr.io/cfpb/regtech/sbl/regtech-cleanup-api:latest 2>/dev/null
# exit 0
- name: Build Mail API
run: |
cd regtech-mail-api
docker pull ghcr.io/cfpb/regtech/sbl/regtech-mail-api:latest 2>/dev/null
docker image tag ghcr.io/cfpb/regtech/sbl/regtech-mail-api:latest sbl-project-mail-api:latest 2>/dev/null
docker build -t sbl-project-mail-api .
docker image tag sbl-project-mail-api:latest ghcr.io/cfpb/regtech/sbl/regtech-mail-api:latest 2>/dev/null
docker image push ghcr.io/cfpb/regtech/sbl/regtech-mail-api:latest 2>/dev/null
exit 0
uses: ./sbl-frontend/.github/actions/build-image
with:
rootDir: regtech-mail-api
localImage: sbl-project-mail-api
remoteImage: ghcr.io/cfpb/regtech/sbl/regtech-mail-api
# run: |
# set +e
# cd regtech-mail-api
# docker pull ghcr.io/cfpb/regtech/sbl/regtech-mail-api:latest 2>/dev/null
# docker image tag ghcr.io/cfpb/regtech/sbl/regtech-mail-api:latest sbl-project-mail-api:latest 2>/dev/null
# docker build -t sbl-project-mail-api .
# docker image tag sbl-project-mail-api:latest ghcr.io/cfpb/regtech/sbl/regtech-mail-api:latest 2>/dev/null
# docker image push ghcr.io/cfpb/regtech/sbl/regtech-mail-api:latest 2>/dev/null
# exit 0
- name: Build User Fi API
run: |
cd regtech-user-fi-management
docker pull ghcr.io/cfpb/regtech/sbl/regtech-user-fi-management:latest 2>/dev/null
docker image tag ghcr.io/cfpb/regtech/sbl/regtech-user-fi-management:latest sbl-project-user-fi:latest 2>/dev/null
docker build -t sbl-project-user-fi .
docker image tag sbl-project-user-fi:latest ghcr.io/cfpb/regtech/sbl/regtech-user-fi-management:latest 2>/dev/null
docker image push ghcr.io/cfpb/regtech/sbl/regtech-user-fi-management:latest 2>/dev/null
exit 0
uses: ./sbl-frontend/.github/actions/build-image
with:
rootDir: regtech-user-fi-management
localImage: sbl-project-user-fi
remoteImage: ghcr.io/cfpb/regtech/sbl/regtech-user-fi-management
# run: |
# set +e
# cd regtech-user-fi-management
# docker pull ghcr.io/cfpb/regtech/sbl/regtech-user-fi-management:latest 2>/dev/null
# docker image tag ghcr.io/cfpb/regtech/sbl/regtech-user-fi-management:latest sbl-project-user-fi:latest 2>/dev/null
# docker build -t sbl-project-user-fi .
# docker image tag sbl-project-user-fi:latest ghcr.io/cfpb/regtech/sbl/regtech-user-fi-management:latest 2>/dev/null
# docker image push ghcr.io/cfpb/regtech/sbl/regtech-user-fi-management:latest 2>/dev/null
# exit 0
- name: Build Filing API
run: |
cd sbl-filing-api
docker pull ghcr.io/cfpb/regtech/sbl/regtech-filing-api:latest 2>/dev/null
docker image tag ghcr.io/cfpb/regtech/sbl/regtech-filing-api:latest sbl-project-filing:latest 2>/dev/null
docker build -t sbl-project-filing .
docker image tag sbl-project-filing:latest ghcr.io/cfpb/regtech/sbl/regtech-filing-api:latest 2>/dev/null
docker image push ghcr.io/cfpb/regtech/sbl/regtech-filing-api:latest 2>/dev/null
exit 0
uses: ./sbl-frontend/.github/actions/build-image
with:
rootDir: sbl-filing-api
localImage: sbl-project-filing
remoteImage: ghcr.io/cfpb/regtech/sbl/regtech-filing-api
# run: |
# set +e
# cd sbl-filing-api
# docker pull ghcr.io/cfpb/regtech/sbl/regtech-filing-api:latest 2>/dev/null
# docker image tag ghcr.io/cfpb/regtech/sbl/regtech-filing-api:latest sbl-project-filing:latest 2>/dev/null
# docker build -t sbl-project-filing .
# docker image tag sbl-project-filing:latest ghcr.io/cfpb/regtech/sbl/regtech-filing-api:latest 2>/dev/null
# docker image push ghcr.io/cfpb/regtech/sbl/regtech-filing-api:latest 2>/dev/null
# exit 0

# Setup node stuff
- name: Setup Node 20
Expand Down

0 comments on commit 7e7fa14

Please sign in to comment.