-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Refactor:Developer] Refactor Repo (#39)
This PR refactor's the whole repo to use the new github action for building and pushing Docker images. This adds a new CI test to only build the changed dockerfiles for PRs to this repo. This is done in this PR to test the building for current dockerfiles before merging. Closes Submitty/Submitty#10461.
- Loading branch information
Showing
33 changed files
with
57 additions
and
295 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
name: Docker Build and Push | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
call-docker-build-push: | ||
uses: submitty/action-docker-build/.github/workflows/[email protected] | ||
with: | ||
push: false | ||
docker_org_name: ${{ vars.docker_org_name }} | ||
base_commit: ${{ github.event.pull_request.base.sha }} | ||
head_commit: ${{ github.event.pull_request.head.sha }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,97 +6,13 @@ on: | |
- "main" | ||
|
||
jobs: | ||
generate-matrix: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
matrix: ${{ steps.set-matrix.outputs.matrix }} | ||
run_docker_jobs: ${{ steps.set-run-docker-jobs.outputs.run_docker_jobs }} | ||
run_latest_docker_jobs: ${{ steps.set-run-docker-jobs.outputs.run_latest_docker_jobs }} | ||
latest-matrix: ${{ steps.set-matrix.outputs.latest-matrix }} | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: ${{ github.event_name == 'pull_request' && 2 || 0 }} | ||
- name: Get changed files | ||
id: changed-files | ||
run: | | ||
echo "changed_files=$(git diff --name-only ${{ github.event.before }} ${{ github.event.after }} | xargs)" >> $GITHUB_OUTPUT | ||
- name: Count number of files changed | ||
id: set-run-docker-jobs | ||
run: | | ||
number_of_changed_files=$(git diff --name-only ${{ github.event.before }} ${{ github.event.after }} | grep -E '^.*\/submitty\/[^/]+\/[^/]+\/Dockerfile$' | wc -l) | ||
echo $number_of_changed_files | ||
if [[ "$number_of_changed_files" -gt 0 ]]; then | ||
echo "run_docker_jobs=true" >> $GITHUB_OUTPUT | ||
else | ||
echo "run_docker_jobs=false" >> $GITHUB_OUTPUT | ||
fi | ||
number_of_changed_latest_files=$(bash ./bin/check_docker_latest_run.sh ${{ github.event.before }} ${{ github.event.after }} | xargs ) | ||
echo $number_of_changed_latest_files | ||
if [[ "$number_of_changed_latest_files" -gt 0 ]]; then | ||
echo "run_latest_docker_jobs=true" >> $GITHUB_OUTPUT | ||
else | ||
echo "run_latest_docker_jobs=false" >> $GITHUB_OUTPUT | ||
fi | ||
- name: List changed files | ||
run: | | ||
for file in ${{ steps.changed-files.outputs.changed_files }}; do | ||
echo "$file was changed" | ||
done | ||
- name: Set Matrix | ||
id: set-matrix | ||
run: | | ||
echo "matrix=$(bash ./bin/generate_matrix.sh ${{ github.event.before }} ${{ github.event.after }} | xargs )" >> $GITHUB_OUTPUT | ||
echo "latest-matrix=$(bash ./bin/generate_latest_matrix.sh ${{ github.event.before }} ${{ github.event.after }} | xargs )" >> $GITHUB_OUTPUT | ||
- name: List Matrix | ||
run: | | ||
echo ${{ steps.set-matrix.outputs.matrix }} | ||
echo ${{ steps.set-run-docker-jobs.outputs.run_docker_jobs }} | ||
echo ${{ steps.set-matrix.outputs.latest-matrix }} | ||
echo ${{ steps.set-run-docker-jobs.outputs.run_latest_docker_jobs }} | ||
docker: | ||
needs: | ||
- generate-matrix | ||
if: needs.generate-matrix.outputs.run_docker_jobs == 'true' | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: true | ||
matrix: ${{ fromJson(needs.generate-matrix.outputs.matrix) }} | ||
steps: | ||
- name: Check out repo | ||
uses: actions/checkout@v3 | ||
- name: Docker Hub login | ||
uses: docker/login-action@releases/v1 | ||
with: | ||
username: ${{ secrets.DOCKER_USERNAME_SUBMITTY }} | ||
password: ${{ secrets.DOCKER_PASSWORD_SUBMITTY }} | ||
- name: Build and push docker | ||
uses: docker/build-push-action@v4 | ||
with: | ||
context: ${{ matrix.context }} | ||
push: true | ||
tags: submitty/${{ matrix.dockername }}:${{ matrix.tag }} | ||
docker-latest: | ||
needs: | ||
- generate-matrix | ||
if: needs.generate-matrix.outputs.run_latest_docker_jobs == 'true' | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: true | ||
matrix: ${{ fromJson(needs.generate-matrix.outputs.latest-matrix) }} | ||
steps: | ||
- name: Check out repo | ||
uses: actions/checkout@v3 | ||
- name: Docker Hub login | ||
uses: docker/login-action@releases/v1 | ||
with: | ||
username: ${{ secrets.DOCKER_USERNAME_SUBMITTY }} | ||
password: ${{ secrets.DOCKER_PASSWORD_SUBMITTY }} | ||
- name: Build and push docker | ||
uses: docker/build-push-action@v4 | ||
with: | ||
context: ${{ matrix.context }} | ||
push: true | ||
tags: submitty/${{ matrix.dockername }}:latest | ||
call-docker-build-push: | ||
uses: submitty/action-docker-build/.github/workflows/[email protected] | ||
with: | ||
push: true | ||
docker_org_name: ${{ vars.docker_org_name }} | ||
base_commit: ${{ github.event.before }} | ||
head_commit: ${{ github.event.after }} | ||
secrets: | ||
docker_username: ${{ secrets.docker_username }} | ||
docker_password: ${{ secrets.docker_password }} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"pushLatest": true, | ||
"latestTag": "ubuntu-20.04" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"pushLatest": true, | ||
"latestTag": "10" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"pushLatest": true, | ||
"latestTag": "11" | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"pushLatest": true, | ||
"latestTag": "7.3-cli" | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"pushLatest": true, | ||
"latestTag": "3.7" | ||
} |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"pushLatest": false | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"pushLatest": false | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.