Skip to content

Commit

Permalink
Merge branch 'main' into rl/upstream-use-common-environment-variable-…
Browse files Browse the repository at this point in the history
…names
  • Loading branch information
Raymond LeClair committed Oct 17, 2023
2 parents be4ca31 + 997d2b4 commit d47bebc
Show file tree
Hide file tree
Showing 5 changed files with 104 additions and 64 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/code-quality.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
name: Code Quality Checks

on: pull_request
on: [pull_request_target]

jobs:
build:
runs-on: ubuntu-latest
name: Code Quality Checks
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- uses: actions/setup-python@v4
with:
python-version: 3.9.13
Expand Down
66 changes: 25 additions & 41 deletions .github/workflows/docker-build.yaml
Original file line number Diff line number Diff line change
@@ -1,52 +1,36 @@
name: Container Processing

on:
on:
push:
pull_request:
branches: [ "main" ]

jobs:
build:
push_to_registry:
name: Push Docker image to DockerHub
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Checkout repository
uses: actions/checkout@v4

- name: Get tag
id: get_tag
run: |
echo "::set-output name=IMAGE_TAG::$(echo $GITHUB_REF | cut -d / -f 3)"
- name: Set up qemu
uses: docker/setup-qemu-action@v3
with:
platforms: all
- name: Set up Docker buildx
id: buildx
uses: docker/setup-buildx-action@v3
with:
version: latest

- name: Set up Docker buildx
id: buildx
uses: docker/setup-buildx-action@v3
with:
version: latest
- name: Log in to DockerHub
uses: docker/login-action@v3
with:
username: ${{ vars.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}

- name: Login to Docker Hub
run: echo "${{ secrets.DOCKER_TOKEN }}" | docker login --username "${{ vars.DOCKER_USERNAME }}" --password-stdin
- name: Set DOCKER_FOLDER
run: echo "DOCKER_FOLDER=$(echo ${{ github.event.repository.name }} | sed 's/edgetech-//')" >> $GITHUB_ENV

- name: Get changes
id: identify
uses: jitterbit/get-changed-files@v1
- run: |
echo ${{ steps.files.output.all }}
- name: Build image
env:
GITHUB_REPOSITORY: ${{ github.repository }}
REPO_TOKEN: ${{ secrets.REPO_TOKEN }}
DOCKER_FOLDER: "daisy"
DOCKER_NAMESPACE: ${{ vars.DOCKER_NAMESPACE }}
TAG_NAME: ${{ steps.get_tag.outputs.IMAGE_TAG }}
run: |
GITHUB_REPO=$(basename $GITHUB_REPOSITORY)
docker buildx build $DOCKER_FOLDER \
--platform linux/arm64,linux/amd64 \
--push \
--tag $DOCKER_NAMESPACE/$GITHUB_REPO:latest \
--tag $DOCKER_NAMESPACE/$GITHUB_REPO:$TAG_NAME
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: ${{ env.DOCKER_FOLDER }}
platforms: linux/arm64,linux/amd64
push: true
tags: ${{ vars.DOCKER_NAMESPACE }}/${{ github.event.repository.name }}:latest
17 changes: 17 additions & 0 deletions .github/workflows/docker-cleanup.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Untag PR Docker Image

on:
pull_request:
types:
- closed

jobs:
untag-image:
name: Untag PR Docker Image from Dockerhub
runs-on: ubuntu-latest

steps:
- name: Untag Docker image on DockerHub
run: |
TOKEN=$(curl -s -H "Content-Type: application/json" -X POST -d '{"username": "${{ vars.DOCKER_USERNAME }}", "password": "${{ secrets.DOCKER_TOKEN }}"}' "https://hub.docker.com/v2/users/login/" | jq -r .token)
curl "https://hub.docker.com/v2/repositories/${{ vars.DOCKER_NAMESPACE }}/${{ github.event.repository.name }}/tags/testing-PR${{ github.event.pull_request.number }}" -X DELETE -H "Authorization: JWT $TOKEN"
32 changes: 32 additions & 0 deletions .github/workflows/docker-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Docker Build Testing

on: [pull_request_target]



jobs:
push_to_registry:
name: Test Docker Build
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}

- name: Set up Docker buildx
id: buildx
uses: docker/setup-buildx-action@v3
with:
version: latest

- name: Set DOCKER_FOLDER
run: echo "DOCKER_FOLDER=$(echo ${{ github.event.repository.name }} | sed 's/edgetech-//')" >> $GITHUB_ENV

- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: ${{ env.DOCKER_FOLDER }}
platforms: linux/arm64,linux/amd64
push: false
tags: ${{ vars.DOCKER_NAMESPACE }}/${{ github.event.repository.name }}:testing-PR${{ github.event.pull_request.number }}
49 changes: 27 additions & 22 deletions .github/workflows/release-tag.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,29 +5,34 @@ on:
types: [ "published" ]

jobs:
tag-remote:
push_to_registry:
name: Dockerhub Release
runs-on: ubuntu-latest
steps:
- name: Set up Docker buildx
id: buildx
uses: docker/setup-buildx-action@v3
with:
version: latest
- name: Checkout repository
uses: actions/checkout@v4

- name: Login to Docker Hub
run: echo "${{ secrets.DOCKER_TOKEN }}" | docker login --username "${{ vars.DOCKER_USERNAME }}" --password-stdin
- name: Set up Docker buildx
id: buildx
uses: docker/setup-buildx-action@v3
with:
version: latest

- name: Build image
env:
GITHUB_REPOSITORY: ${{ github.repository }}
REPO_TOKEN: ${{ secrets.REPO_TOKEN }}
DOCKER_FOLDER: "daisy"
DOCKER_NAMESPACE: ${{ vars.DOCKER_NAMESPACE }}
RELEASE_NAME: ${{ github.event.release.name }}
run: |
GITHUB_REPO=$(basename $GITHUB_REPOSITORY)
docker buildx build $DOCKER_FOLDER \
--platform linux/arm64,linux/amd64 \
--push \
--tag $DOCKER_NAMESPACE/$GITHUB_REPO:latest \
--tag $DOCKER_NAMESPACE/$GITHUB_REPO:$RELEASE_NAME
- name: Log in to DockerHub
uses: docker/login-action@v3
with:
username: ${{ vars.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}

- name: Set DOCKER_FOLDER
run: echo "DOCKER_FOLDER=$(echo ${{ github.event.repository.name }} | sed 's/edgetech-//')" >> $GITHUB_ENV

- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: ${{ env.DOCKER_FOLDER }}
platforms: linux/arm64,linux/amd64
push: true
tags: |
${{ vars.DOCKER_NAMESPACE }}/${{ github.event.repository.name }}:${{ github.event.release.name }}
${{ vars.DOCKER_NAMESPACE }}/${{ github.event.repository.name }}:stable

0 comments on commit d47bebc

Please sign in to comment.