-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Unify user focused Docker images
- Loading branch information
1 parent
1a0037c
commit 9299b25
Showing
11 changed files
with
99 additions
and
157 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 |
---|---|---|
|
@@ -19,7 +19,7 @@ on: | |
- major | ||
default: patch | ||
build-docker: | ||
description: Release companion Docker and Action Docker images | ||
description: Release companion Docker image | ||
type: boolean | ||
default: true | ||
|
||
|
@@ -71,32 +71,6 @@ jobs: | |
push: 'origin main --force' | ||
tag: 'v${{steps.publish.outputs.version}} --force' | ||
|
||
deploy-docker-action: | ||
if: ${{ github.event.inputs.job == 'cli' && github.event.inputs.build-docker }} | ||
runs-on: ubuntu-latest | ||
needs: deploy-cli | ||
env: | ||
DIR: apps/action | ||
steps: | ||
- uses: actions/[email protected] | ||
- name: Docker login | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ vars.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
||
- name: Build and push | ||
uses: docker/[email protected] | ||
with: | ||
context: ${{env.DIR}} | ||
file: ${{env.DIR}}/action.Dockerfile | ||
platforms: linux/amd64 | ||
push: true | ||
build-args: CLI_VERSION=${{needs.deploy-cli.outputs.version}} | ||
tags: | | ||
sokari/allure-deployer-action:${{needs.deploy-cli.outputs.version}} | ||
sokari/allure-deployer-action:${{ github.sha }} | ||
deploy-docker: | ||
if: ${{ github.event.inputs.job == 'cli' && github.event.inputs.build-docker }} | ||
runs-on: ubuntu-latest | ||
|
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 |
---|---|---|
|
@@ -84,7 +84,7 @@ jobs: | |
steps: | ||
- uses: actions/[email protected] | ||
- name: Allure Deployer Action | ||
uses: ./apps/action | ||
uses: ./apps/docker | ||
env: | ||
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} | ||
SLACK_TOKEN: ${{secrets.SLACK_TOKEN}} | ||
|
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
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,63 @@ | ||
#!/bin/sh | ||
|
||
# Exit immediately if a command exits with a non-zero status | ||
set -e | ||
|
||
GOOGLE_APPLICATION_CREDENTIALS="/credentials/key.json" | ||
if [ -f "$GOOGLE_APPLICATION_CREDENTIALS" ]; then | ||
# Running as an bare container | ||
export GOOGLE_APPLICATION_CREDENTIALS | ||
ALLURE_RESULTS_PATH="/allure-results" | ||
# Check if /allure-results directory is mounted | ||
if [ ! -d "$ALLURE_RESULTS_PATH" ]; then | ||
echo "Error: $ALLURE_RESULTS_PATH directory is not mounted" | ||
exit 1 | ||
fi | ||
|
||
elif [ -d "/github/workspace" ]; then | ||
#Running as a GitHub Action container | ||
if [ -z "$GOOGLE_CREDENTIALS_JSON" ]; then | ||
echo "Error: Provide a Firebase Google JSON credential " | ||
exit 1 | ||
else | ||
# Create directory for the JSON file | ||
DIR="/credentials" | ||
mkdir -p DIR | ||
JSON_FILE="$DIR/key.json" | ||
# Write the $GOOGLE_CREDENTIALS_JSON content to the JSON file | ||
echo "$GOOGLE_CREDENTIALS_JSON" > "$JSON_FILE" # No cleanup needed, in non mounted Docker path | ||
# Export as GOOGLE_APPLICATION_CREDENTIALS for Firebase CLI auto auth | ||
export GOOGLE_APPLICATION_CREDENTIALS="$JSON_FILE" | ||
fi | ||
|
||
# Create variables by stripping "key=" and keeping only the value from | ||
# GitHub action arguments | ||
STORAGE_BUCKET="${1#*=}" | ||
REPORT_NAME="${2#*=}" | ||
SLACK_CHANNEL="${3#*=}" | ||
ALLURE_RESULTS_PATH="${4#*=}" | ||
SHOW_RETRIES="${5#*=}" | ||
SHOW_HISTORY="${6#*=}" | ||
PREFIX="${7#*=}" | ||
UPDATE_PR="${8#*=}" | ||
else | ||
echo "Error: No credential file exists at $GOOGLE_APPLICATION_CREDENTIALS. Please mount a Firebase Google JSON file" | ||
exit 1 | ||
fi | ||
|
||
# Construct the command with all optional variables | ||
deploy_command="allure-deployer deploy \"$ALLURE_RESULTS_PATH\"" | ||
|
||
[ -n "$REPORT_NAME" ] && deploy_command="$deploy_command $REPORT_NAME" | ||
[ -n "$GOOGLE_APPLICATION_CREDENTIALS" ] && deploy_command="$deploy_command --gcp-json $GOOGLE_APPLICATION_CREDENTIALS" | ||
[ -n "$STORAGE_BUCKET" ] && deploy_command="$deploy_command --bucket $STORAGE_BUCKET" | ||
[ "$SHOW_RETRIES" = "true" ] && deploy_command="$deploy_command --show-retries" | ||
[ "$SHOW_HISTORY" = "true" ] && deploy_command="$deploy_command --show-history" | ||
[ -n "$SLACK_CHANNEL" ] && deploy_command="$deploy_command --slack-channel $SLACK_CHANNEL" | ||
[ -n "$SLACK_TOKEN" ] && deploy_command="$deploy_command --slack-token $SLACK_TOKEN" | ||
[ -n "$PREFIX" ] && deploy_command="$deploy_command --prefix $PREFIX" | ||
[ -n "$UPDATE_PR" ] && deploy_command="$deploy_command --update-pr $UPDATE_PR" | ||
|
||
# Execute the constructed command | ||
eval "$deploy_command" | ||
#tail -f /dev/null |
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
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,30 @@ | ||
# This image npm pack the CLI for testing | ||
FROM node:20-alpine AS javanode | ||
RUN apk add openjdk17-jre | ||
|
||
FROM node:20-alpine AS build | ||
WORKDIR /app | ||
ENV CLI_DIR=/apps/cli | ||
COPY $CLI_DIR/src src | ||
COPY $CLI_DIR/package*.json /app/ | ||
COPY $CLI_DIR/tsconfig.json . | ||
COPY $CLI_DIR/version-update.cjs . | ||
|
||
RUN npm install | ||
RUN npm run build | ||
RUN npm publish --dry-run | ||
RUN npm pack | ||
RUN mv allure-deployer*.tgz allure-deployer.tgz | ||
|
||
FROM javanode AS install | ||
COPY --from=build /app/allure-deployer.tgz allure-deployer.tgz | ||
|
||
RUN npm i -g allure-deployer.tgz | ||
|
||
RUN allure-deployer -V | ||
|
||
COPY apps/docker/entrypoint.sh /entrypoint.sh | ||
RUN chmod +x /entrypoint.sh | ||
|
||
ENTRYPOINT ["/entrypoint.sh"] | ||
|