Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement cicd-docker-build-and-distribute workflow. #243

Merged
merged 1 commit into from
Mar 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/actions/teleport/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ runs:

- name: Fetch credentials using Machine ID
id: auth
uses: teleport-actions/auth@v1
uses: teleport-actions/auth@v2
if: env.HOSTNAME != ''
with:
# Use the address of the auth/proxy server for your own cluster.
Expand All @@ -72,7 +72,7 @@ runs:
- name: Authorize against Teleport
id: auth-k8s
if: inputs.K8S_CLUSTER_NAME != ''
uses: teleport-actions/auth-k8s@v1.1.4
uses: teleport-actions/auth-k8s@v2
with:
# Specify the publically accessible address of your Teleport proxy.
proxy: ${{ env.PROXY_URL }}
Expand Down
48 changes: 35 additions & 13 deletions .github/workflows/ci-docker-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,17 @@ name: Build via Docker
on:
workflow_call:
inputs:
ENVIRONMENT:
required: false
type: string
description: Environment where the variables and secrets are scoped to
RUNNER:
required: false
default: ubuntu-latest
description: A GitHub runner type
type: string
REPO_DOMAIN:
required: true
required: false
description: Domain name of repository
type: string
PLATFORM:
Expand All @@ -15,6 +24,10 @@ on:
required: true
description: Path to Dockerfile
type: string
MAINTAINER:
required: true
description: Package maintainer
type: string
ARTIFACTS_PATTERN:
required: false
default: '.*\.(deb|rpm)$'
Expand All @@ -24,15 +37,21 @@ on:
required: true
description: Artifact name
type: string
MAINTAINER:
required: true
description: Package maintainer
type: string
UPLOAD_ARTIFACTS:
UPLOAD_BUILD_ARTIFACTS:
required: false
type: boolean
default: true
description: 'Enable upload artifacts related steps'
description: Enable upload build artifacts related steps
ARTIFACT_RETENTION_DAYS:
required: false
type: number
default: 1
description: Number of days to keep build artifacts
LOG_RETENTION_DAYS:
required: false
type: number
default: 7
description: Number of days to keep build log artifacts
secrets:
REPO_USERNAME:
required: true
Expand All @@ -41,7 +60,8 @@ on:

jobs:
build-docker:
runs-on: ubuntu-latest
runs-on: ${{ inputs.RUNNER }}
environment: ${{ inputs.ENVIRONMENT }}
steps:

- name: Checkout code
Expand Down Expand Up @@ -122,26 +142,28 @@ jobs:

printf ${GITHUB_SHA} | tee "${ARTIFACTS_DIR}/hash.txt"

- name: Upload logs
- name: Upload build logs
uses: actions/upload-artifact@v4
with:
name: ${{ inputs.TARGET_ARTIFACT_NAME }}.log
path: artifacts-*.log
if-no-files-found: warn
retention-days: ${{ inputs.LOG_RETENTION_DAYS }}

- name: Compress artifacts
if: ${{ inputs.UPLOAD_ARTIFACTS }}
- name: Compress build artifacts
if: ${{ inputs.UPLOAD_BUILD_ARTIFACTS }}
shell: bash
run: |
tar -czvf ${{ inputs.TARGET_ARTIFACT_NAME }}.tar.gz -C "${ARTIFACTS_DIR}" $(ls -1 "${ARTIFACTS_DIR}")
sha512sum ${{ inputs.TARGET_ARTIFACT_NAME }}.tar.gz | tee ${{ inputs.TARGET_ARTIFACT_NAME }}.tar.gz.sha512

- name: Upload artifacts
if: ${{ inputs.UPLOAD_ARTIFACTS }}
- name: Upload build artifacts
if: ${{ inputs.UPLOAD_BUILD_ARTIFACTS }}
uses: actions/upload-artifact@v4
with:
name: ${{ inputs.TARGET_ARTIFACT_NAME }}
path: |
*.tar.gz
*.sha512
if-no-files-found: error
retention-days: ${{ inputs.ARTIFACT_RETENTION_DAYS }}
Loading