forked from AlabamaWaterInstitute/CloudInfra
-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* refactor workflows to fix pr from forked repo * add condition to run step * fix the condition * set load true * set docker buildkit to 0 * add platform * no cache false * no cache true * set cache from to * push false * move cache * comment start and stop runner * fix indentation * push to local repository * remove local push * fix runner label * remove cache * no cache true * add platform * uncomment lines and add x86 workflow * rename workflow file * do not start and stop runner from forked repo
- Loading branch information
1 parent
15025e8
commit bcc9dcf
Showing
7 changed files
with
239 additions
and
51 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
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,58 @@ | ||
name: build and test template | ||
description: "A template to build and test docker image based on provided inputs" | ||
|
||
inputs: | ||
docker-auth-token: | ||
description: 'Docker Hub authentication token' | ||
required: true | ||
image-name: | ||
description: 'image name to be built' | ||
required: true | ||
dockerfile-name: | ||
description: 'The name of dockerfile to use' | ||
required: true | ||
platform: | ||
description: 'The platform to build' | ||
required: false | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v1 | ||
|
||
- name: Set env vars for main branch | ||
shell: bash | ||
run: | | ||
echo "TAG_NAME=latest" >> "$GITHUB_ENV" | ||
if: startsWith(github.ref, 'refs/heads/main') | ||
- name: Set env vars for other branch | ||
shell: bash | ||
run: | | ||
echo "TAG_NAME=${GITHUB_REF##*/}" >> "$GITHUB_ENV" | ||
if: ${{ !startsWith(github.ref, 'refs/heads/main') }} | ||
- name: Attach platform to tag | ||
shell: bash | ||
run: | | ||
echo "TAG_NAME=${{env.TAG_NAME}}-${{inputs.platform}}" >> "$GITHUB_ENV" | ||
if: "${{ inputs.platform != 'ARM64' }}" | ||
- name: Create Cache and Builder for Buildx | ||
shell: bash | ||
run: | | ||
docker buildx create --use --name mybuilder --node mybuilder | ||
- name: Build and Cache Docker Image | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: ./docker | ||
file: ./docker/${{ inputs.dockerfile-name}} | ||
build-args: | | ||
TAG_NAME=${{ env.TAG_NAME}} | ||
push: true | ||
tags: | | ||
awiciroh/${{ inputs.image-name}}:${{ env.TAG_NAME}} | ||
builder: mybuilder | ||
no-cache: true | ||
env: | ||
DOCKER_BUILDKIT: 1 | ||
DOCKER_CLI_EXPERIMENTAL: enabled |
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 |
---|---|---|
@@ -1,23 +1,30 @@ | ||
name: Build and push deps image | ||
on: | ||
push: | ||
branches: [ main ] | ||
paths: | ||
- docker/** | ||
workflow_dispatch: | ||
workflow_call: | ||
inputs: | ||
runner_label: | ||
required: true | ||
type: string | ||
jobs: | ||
build-and-push: | ||
runs-on: self-hosted | ||
strategy: | ||
matrix: | ||
architecture: [arm64] | ||
runs-on: ["${{inputs.runner_label}}"] | ||
steps: | ||
- name: deploy | ||
uses: actions/checkout@v2 | ||
- name: Build and test Docker image | ||
uses: ./.github/action_templates/build-and-test | ||
with: | ||
docker-auth-token: ${{ secrets.DOCKER_AUTH_TOKEN }} | ||
image-name: "ngen-deps" | ||
dockerfile-name: "Dockerfile.ngen-deps" | ||
platform: ${{inputs.runner_label}} | ||
if: ${{ !startsWith(github.ref, 'refs/heads/main') }} | ||
- name: Build and push Docker image | ||
uses: ./.github/action_templates/build-and-push | ||
with: | ||
docker-auth-token: ${{ secrets.DOCKER_AUTH_TOKEN }} | ||
image-name: "ngen-deps" | ||
dockerfile-name: "Dockerfile.ngen-deps" | ||
dockerfile-name: "Dockerfile.ngen-deps" | ||
platform: ${{inputs.runner_label}} | ||
if: startsWith(github.ref, 'refs/heads/main') |
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,80 @@ | ||
name: X86 Build and push final image | ||
on: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
deps: | ||
uses: ./.github/workflows/docker_deps_image.yml | ||
with: | ||
runner_label: X86 | ||
secrets: inherit | ||
troute: | ||
needs: deps | ||
uses: ./.github/workflows/docker_troute_image.yml | ||
with: | ||
runner_label: X86 | ||
secrets: inherit | ||
ngen: | ||
needs: troute | ||
uses: ./.github/workflows/docker_ngen_image.yml | ||
with: | ||
runner_label: X86 | ||
secrets: inherit | ||
final: | ||
needs: ngen | ||
runs-on: X86 | ||
steps: | ||
- name: deploy | ||
uses: actions/checkout@v2 | ||
- name: Build and test Docker image | ||
uses: ./.github/action_templates/build-and-test | ||
with: | ||
docker-auth-token: ${{ secrets.DOCKER_AUTH_TOKEN }} | ||
image-name: "ciroh-ngen-image" | ||
dockerfile-name: "Dockerfile" | ||
platform: X86 | ||
if: ${{ !startsWith(github.ref, 'refs/heads/main') }} | ||
- name: Build and push Docker image | ||
uses: ./.github/action_templates/build-and-push | ||
with: | ||
docker-auth-token: ${{ secrets.DOCKER_AUTH_TOKEN }} | ||
image-name: "ciroh-ngen-image" | ||
dockerfile-name: "Dockerfile" | ||
platform: X86 | ||
if: startsWith(github.ref, 'refs/heads/main') | ||
check_result: | ||
needs: final | ||
runs-on: X86 | ||
outputs: | ||
output1: ${{ steps.step1.outputs.result }} | ||
steps: | ||
- id: step1 | ||
run: echo "result=success" >> "$GITHUB_OUTPUT" | ||
|
||
slack: | ||
runs-on: X86 | ||
if: ${{ always() }} | ||
needs: [deps, troute, ngen, final, check_result] | ||
env: | ||
OUTPUT: ${{needs.check_result.outputs.output1}} | ||
steps: | ||
- name: Set env JOBSTATUS | ||
run: | | ||
echo "$OUTPUT" | ||
if [[ "success" = "$OUTPUT" ]] | ||
then | ||
echo "JOBSTATUS=success" >> "$GITHUB_ENV" | ||
else | ||
echo "JOBSTATUS=failure" >> "$GITHUB_ENV" | ||
fi | ||
- run: echo "$JOBSTATUS" | ||
- name: deploy | ||
uses: actions/checkout@v2 | ||
- name: Publish slack message | ||
if: always() | ||
uses: ./.github/action_templates/slack | ||
with: | ||
slack-webhook-url: ${{ secrets.SLACK_WEBHOOK_URL }} | ||
job-status: ${{ env.JOBSTATUS }} | ||
pull_request_url: ${{ github.event.pull_request.html_url }} | ||
head_commit_url: ${{ github.event.head_commit.url }} |
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 |
---|---|---|
@@ -1,21 +1,30 @@ | ||
name: Build and push ngen image | ||
on: | ||
push: | ||
branches: [ main ] | ||
paths: | ||
- docker/** | ||
workflow_dispatch: | ||
workflow_call: | ||
|
||
inputs: | ||
runner_label: | ||
required: true | ||
type: string | ||
jobs: | ||
build-and-push: | ||
runs-on: self-hosted | ||
runs-on: ["${{inputs.runner_label}}"] | ||
steps: | ||
- name: deploy | ||
uses: actions/checkout@v2 | ||
- name: Build and push Docker image | ||
uses: ./.github/action_templates/build-and-test | ||
with: | ||
docker-auth-token: ${{ secrets.DOCKER_AUTH_TOKEN }} | ||
image-name: "ngen" | ||
dockerfile-name: "Dockerfile.ngen" | ||
platform: ${{inputs.runner_label}} | ||
if: ${{ !startsWith(github.ref, 'refs/heads/main') }} | ||
- name: Build and push Docker image | ||
uses: ./.github/action_templates/build-and-push | ||
with: | ||
docker-auth-token: ${{ secrets.DOCKER_AUTH_TOKEN }} | ||
image-name: "ngen" | ||
dockerfile-name: "Dockerfile.ngen" | ||
dockerfile-name: "Dockerfile.ngen" | ||
platform: ${{inputs.runner_label}} | ||
if: startsWith(github.ref, 'refs/heads/main') |
Oops, something went wrong.