Skip to content

Commit

Permalink
feat(PRE-COMMIT): support gettext translations
Browse files Browse the repository at this point in the history
  • Loading branch information
niall-byrne committed Jul 24, 2024
1 parent c15f29f commit c286aa5
Show file tree
Hide file tree
Showing 32 changed files with 1,305 additions and 57 deletions.
4 changes: 4 additions & 0 deletions .cicd-tools/bin/manifest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ manifest() {
}

_manifest_args() {
local OPTARG
local OPTIND
local OPTION

while getopts "m:" OPTION; do
case "$OPTION" in
m)
Expand Down
4 changes: 4 additions & 0 deletions .cicd-tools/bin/toolbox.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ main() {
}

_toolbox_args() {
local OPTARG
local OPTIND
local OPTION

while getopts "b:m:r:t:" OPTION; do
case "$OPTION" in
b)
Expand Down
4 changes: 4 additions & 0 deletions .cicd-tools/bin/verify.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ main() {
}

_verify_args() {
local OPTARG
local OPTIND
local OPTION

while getopts "k:" OPTION; do
case "$OPTION" in
k)
Expand Down
1 change: 1 addition & 0 deletions .cicd-tools/boxes/bootstrap/libraries/gettext.sh
19 changes: 19 additions & 0 deletions .cicd-tools/containers/gettext/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
FROM debian:stable

LABEL org.opencontainers.image.source=https://github.com/cicd-tools-org/cicd-tools
LABEL org.opencontainers.image.description="FOSS gettext binaries for CICD-Tools."

ENV DEBIAN_FRONTEND=noninteractive

RUN apt-get update && \
apt-get install \
-y \
--no-install-recommends \
gettext=0.* && \
apt-get clean && \
rm -rf /var/cache/apt/* && \
rm -rf /var/lib/apt/lists/* && \
rm -rf /tmp/*

RUN mkdir -p /mnt
WORKDIR /mnt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ubuntu:22.04 as sha
FROM ubuntu:22.04 AS sha

ARG BUILD_ARG_ARCH_FORMAT_1
ARG BUILD_ARG_ARCH_FORMAT_2
Expand All @@ -14,14 +14,14 @@ RUN apt-get update \
xz-utils \
&& rm -rf /var/lib/apt/lists/*

ENV ACTIONLINT_VERSION "https://github.com/rhysd/actionlint/releases/download/v1.6.26/actionlint_1.6.26_linux_${BUILD_ARG_ARCH_FORMAT_1}.tar.gz"
ENV HADOLINT_VERSION "https://github.com/hadolint/hadolint/releases/download/v2.12.0/hadolint-Linux-${BUILD_ARG_ARCH_FORMAT_2}"
ENV JQ_VERSION "https://github.com/jqlang/jq/releases/download/jq-1.7.1/jq-linux-${BUILD_ARG_ARCH_FORMAT_1}"
ENV SHFMT_VERSION "https://github.com/mvdan/sh/releases/download/v3.7.0/shfmt_v3.7.0_linux_${BUILD_ARG_ARCH_FORMAT_1}"
ENV SHELLCHECK_VERSION "https://github.com/koalaman/shellcheck/releases/download/v0.9.0/shellcheck-v0.9.0.linux.${BUILD_ARG_ARCH_FORMAT_3}.tar.xz"
ENV TOMLL_VERSION "https://github.com/pelletier/go-toml/releases/download/v2.1.1/tomll_2.1.1_linux_${BUILD_ARG_ARCH_FORMAT_1}.tar.xz"
ENV VALE_VERSION "https://github.com/errata-ai/vale/releases/download/v2.30.0/vale_2.30.0_Linux_${BUILD_ARG_ARCH_FORMAT_4}.tar.gz"
ENV VALE3_VERSION "https://github.com/errata-ai/vale/releases/download/v3.6.0/vale_3.6.0_Linux_${BUILD_ARG_ARCH_FORMAT_4}.tar.gz"
ENV ACTIONLINT_VERSION="https://github.com/rhysd/actionlint/releases/download/v1.6.26/actionlint_1.6.26_linux_${BUILD_ARG_ARCH_FORMAT_1}.tar.gz"
ENV HADOLINT_VERSION="https://github.com/hadolint/hadolint/releases/download/v2.12.0/hadolint-Linux-${BUILD_ARG_ARCH_FORMAT_2}"
ENV JQ_VERSION="https://github.com/jqlang/jq/releases/download/jq-1.7.1/jq-linux-${BUILD_ARG_ARCH_FORMAT_1}"
ENV SHFMT_VERSION="https://github.com/mvdan/sh/releases/download/v3.7.0/shfmt_v3.7.0_linux_${BUILD_ARG_ARCH_FORMAT_1}"
ENV SHELLCHECK_VERSION="https://github.com/koalaman/shellcheck/releases/download/v0.9.0/shellcheck-v0.9.0.linux.${BUILD_ARG_ARCH_FORMAT_3}.tar.xz"
ENV TOMLL_VERSION="https://github.com/pelletier/go-toml/releases/download/v2.1.1/tomll_2.1.1_linux_${BUILD_ARG_ARCH_FORMAT_1}.tar.xz"
ENV VALE_VERSION="https://github.com/errata-ai/vale/releases/download/v2.30.0/vale_2.30.0_Linux_${BUILD_ARG_ARCH_FORMAT_4}.tar.gz"
ENV VALE3_VERSION="https://github.com/errata-ai/vale/releases/download/v3.6.0/vale_3.6.0_Linux_${BUILD_ARG_ARCH_FORMAT_4}.tar.gz"

RUN mkdir -p /dist

Expand Down Expand Up @@ -60,7 +60,7 @@ WORKDIR /dist

RUN sha256sum -c Dockerfile.sha256 && exit 0 || sha256sum /dist/* && exit 127

FROM scratch as ship
FROM scratch AS ship

LABEL org.opencontainers.image.source=https://github.com/cicd-tools-org/cicd-tools
LABEL org.opencontainers.image.description="FOSS binaries for CICD-Tools."
Expand Down
2 changes: 1 addition & 1 deletion .github/scenarios/0.toml_linting-0.workflow_linting.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"_GITHUB_CI_DEFAULT_VERBOSE_NOTIFICATIONS": true,
"_*DO_NOT_MODIFY_THIS_FILE*": "This file is created to assist with upgrading to future versions of this template.",
"_copy_without_render": [
".cicd-tools/boxes/bootstrap/libraries/environment.sh",
".cicd-tools/**/*",
".github/actions",
"ansible_role/*",
"scripts/*"
Expand Down
2 changes: 1 addition & 1 deletion .github/scenarios/0.toml_linting-1.workflow_linting.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"_GITHUB_CI_DEFAULT_VERBOSE_NOTIFICATIONS": true,
"_*DO_NOT_MODIFY_THIS_FILE*": "This file is created to assist with upgrading to future versions of this template.",
"_copy_without_render": [
".cicd-tools/boxes/bootstrap/libraries/environment.sh",
".cicd-tools/**/*",
".github/actions",
"ansible_role/*",
"scripts/*"
Expand Down
2 changes: 1 addition & 1 deletion .github/scenarios/1.toml_linting-0.workflow_linting.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"_GITHUB_CI_DEFAULT_VERBOSE_NOTIFICATIONS": true,
"_*DO_NOT_MODIFY_THIS_FILE*": "This file is created to assist with upgrading to future versions of this template.",
"_copy_without_render": [
".cicd-tools/boxes/bootstrap/libraries/environment.sh",
".cicd-tools/**/*",
".github/actions",
"ansible_role/*",
"scripts/*"
Expand Down
2 changes: 1 addition & 1 deletion .github/scenarios/1.toml_linting-1.workflow_linting.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"_GITHUB_CI_DEFAULT_VERBOSE_NOTIFICATIONS": true,
"_*DO_NOT_MODIFY_THIS_FILE*": "This file is created to assist with upgrading to future versions of this template.",
"_copy_without_render": [
".cicd-tools/boxes/bootstrap/libraries/environment.sh",
".cicd-tools/**/*",
".github/actions",
"ansible_role/*",
"scripts/*"
Expand Down
143 changes: 143 additions & 0 deletions .github/workflows/workflow-container-gettext-multiarch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
---
name: cicd-tooling-github-workflow-container-gettext-multiarch

on:
push:
paths:
- ".cicd-tools/containers/gettext"
- ".github/workflows/workflow-container-gettext-multiarch.yml"
- ".github/workflows/job-*-container-*.yml"
- "scripts/container.sh"
schedule:
- cron: "0 6 * * 1"
workflow_dispatch:

# secrets:
# SLACK_WEBHOOK:
# description: "Optional, enables Slack notifications."
# required: false

jobs:

configuration:
uses: ./.github/workflows/job-00-cookiecutter-read_configuration.yml

start:
secrets:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
uses: ./.github/workflows/job-00-generic-notification.yml
with:
NOTIFICATION_EMOJI: ":vertical_traffic_light:"
NOTIFICATION_MESSAGE: "Multi-arch container build has started!"
WORKFLOW_NAME: "gettext-container"

security:
needs:
- configuration
secrets:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
uses: ./.github/workflows/job-10-generic-security_scan_credentials.yml
with:
VERBOSE_NOTIFICATIONS: ${{ fromJSON(needs.configuration.outputs.COOKIECUTTER_CONFIGURATION)._GITHUB_CI_DEFAULT_VERBOSE_NOTIFICATIONS }}
WORKFLOW_NAME: "gettext-container"

scan:
permissions:
security-events: write
needs:
- configuration
secrets:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
strategy:
fail-fast: true
matrix:
include:
- build-platform: linux/amd64
build-tag: linux-amd64
- build-platform: linux/arm64
build-tag: linux-arm64
max-parallel: ${{ fromJSON(needs.configuration.outputs.COOKIECUTTER_CONFIGURATION)._GITHUB_CI_DEFAULT_CONCURRENCY }}
uses: ./.github/workflows/job-10-container-security_scan_container.yml
with:
CONTEXT: .cicd-tools/containers/gettext
FAIL_BUILD: true
FAIL_THRESHOLD: "critical"
FIXED_ONLY: true
IMAGE_NAME: cicd-tools-org/cicd-tools-gettext
IMAGE_TAG: ${{ matrix.build-tag }}
PLATFORM: ${{ matrix.build-platform }}
REQUIRES_QEMU: true
VERBOSE_NOTIFICATIONS: ${{ fromJSON(needs.configuration.outputs.COOKIECUTTER_CONFIGURATION)._GITHUB_CI_DEFAULT_VERBOSE_NOTIFICATIONS }}
WORKFLOW_NAME: "gettext-container"

lint:
needs:
- configuration
secrets:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
uses: ./.github/workflows/job-80-container-dockerfile_linter.yml
with:
DOCKERFILE: .cicd-tools/containers/gettext/Dockerfile
VERBOSE_NOTIFICATIONS: ${{ fromJSON(needs.configuration.outputs.COOKIECUTTER_CONFIGURATION)._GITHUB_CI_DEFAULT_VERBOSE_NOTIFICATIONS }}
WORKFLOW_NAME: "gettext-container"

push:
needs:
- configuration
- lint
- scan
- security
- start
permissions:
packages: write
secrets:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
strategy:
fail-fast: true
matrix:
include:
- build-platform: linux/amd64
build-tag: linux-amd64
- build-platform: linux/arm64
build-tag: linux-arm64
max-parallel: ${{ fromJSON(needs.configuration.outputs.COOKIECUTTER_CONFIGURATION)._GITHUB_CI_DEFAULT_CONCURRENCY }}
uses: ./.github/workflows/job-95-container-push.yml
with:
CONTEXT: .cicd-tools/containers/gettext
IMAGE_NAME: cicd-tools-org/cicd-tools-gettext
IMAGE_TAG: ${{ matrix.build-tag }}
PLATFORM: ${{ matrix.build-platform }}
REQUIRES_QEMU: true
VERBOSE_NOTIFICATIONS: ${{ fromJSON(needs.configuration.outputs.COOKIECUTTER_CONFIGURATION)._GITHUB_CI_DEFAULT_VERBOSE_NOTIFICATIONS }}
WORKFLOW_NAME: "gettext-container"

multiarch:
needs:
- configuration
- push
permissions:
packages: write
secrets:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
uses: ./.github/workflows/job-95-container-multiarch.yml
with:
IMAGE_GIT: true
IMAGE_LATEST: true
IMAGE_NAME: cicd-tools-org/cicd-tools-gettext
MULTIARCH_TAG: "multiarch"
SOURCE_TAGS: |
linux-amd64
linux-arm64
VERBOSE_NOTIFICATIONS: ${{ fromJSON(needs.configuration.outputs.COOKIECUTTER_CONFIGURATION)._GITHUB_CI_DEFAULT_VERBOSE_NOTIFICATIONS }}
WORKFLOW_NAME: "gettext-container"

success:
needs:
- multiarch
secrets:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
uses: ./.github/workflows/job-00-generic-notification.yml
with:
NOTIFICATION_EMOJI: ":checkered_flag:"
NOTIFICATION_MESSAGE: "Multi-arch container build has completed successfully!"
WORKFLOW_NAME: "gettext-container"
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
---
name: cicd-tooling-github-workflow-container-multiarch
name: cicd-tooling-github-workflow-container-utilities-multiarch

on:
push:
paths:
- ".github/workflows/workflow-container-multiarch.yml"
- ".cicd-tools/containers/utilities"
- ".github/workflows/workflow-container-utilities-multiarch.yml"
- ".github/workflows/job-*-container-*.yml"
- ".cicd-tools/container/Dockerfile"
- ".cicd-tools/container/Dockerfile.sha256"
- "scripts/container.sh"
schedule:
- cron: "0 6 * * 1"
Expand All @@ -30,7 +29,7 @@ jobs:
with:
NOTIFICATION_EMOJI: ":vertical_traffic_light:"
NOTIFICATION_MESSAGE: "Multi-arch container build has started!"
WORKFLOW_NAME: "container"
WORKFLOW_NAME: "utilities-container"

security:
needs:
Expand All @@ -40,7 +39,7 @@ jobs:
uses: ./.github/workflows/job-10-generic-security_scan_credentials.yml
with:
VERBOSE_NOTIFICATIONS: ${{ fromJSON(needs.configuration.outputs.COOKIECUTTER_CONFIGURATION)._GITHUB_CI_DEFAULT_VERBOSE_NOTIFICATIONS }}
WORKFLOW_NAME: "container"
WORKFLOW_NAME: "utilities-container"

scan:
permissions:
Expand Down Expand Up @@ -71,15 +70,15 @@ jobs:
uses: ./.github/workflows/job-10-container-security_scan_container.yml
with:
BUILD_ARGS: ${{ matrix.build-args }}
CONTEXT: .cicd-tools/container
CONTEXT: .cicd-tools/containers/utilities
FAIL_BUILD: true
FAIL_THRESHOLD: "critical"
FIXED_ONLY: true
IMAGE_TAG: ${{ matrix.build-tag }}
PLATFORM: ${{ matrix.build-platform }}
REQUIRES_QEMU: true
VERBOSE_NOTIFICATIONS: ${{ fromJSON(needs.configuration.outputs.COOKIECUTTER_CONFIGURATION)._GITHUB_CI_DEFAULT_VERBOSE_NOTIFICATIONS }}
WORKFLOW_NAME: "container"
WORKFLOW_NAME: "utilities-container"

lint:
needs:
Expand All @@ -88,9 +87,9 @@ jobs:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
uses: ./.github/workflows/job-80-container-dockerfile_linter.yml
with:
DOCKERFILE: .cicd-tools/container/Dockerfile
DOCKERFILE: .cicd-tools/containers/utilities/Dockerfile
VERBOSE_NOTIFICATIONS: ${{ fromJSON(needs.configuration.outputs.COOKIECUTTER_CONFIGURATION)._GITHUB_CI_DEFAULT_VERBOSE_NOTIFICATIONS }}
WORKFLOW_NAME: "container"
WORKFLOW_NAME: "utilities-container"

push:
needs:
Expand Down Expand Up @@ -125,12 +124,12 @@ jobs:
uses: ./.github/workflows/job-95-container-push.yml
with:
BUILD_ARGS: ${{ matrix.build-args }}
CONTEXT: .cicd-tools/container
CONTEXT: .cicd-tools/containers/utilities
IMAGE_TAG: ${{ matrix.build-tag }}
PLATFORM: ${{ matrix.build-platform }}
REQUIRES_QEMU: true
VERBOSE_NOTIFICATIONS: ${{ fromJSON(needs.configuration.outputs.COOKIECUTTER_CONFIGURATION)._GITHUB_CI_DEFAULT_VERBOSE_NOTIFICATIONS }}
WORKFLOW_NAME: "container"
WORKFLOW_NAME: "utilities-container"

multiarch:
needs:
Expand All @@ -149,7 +148,7 @@ jobs:
linux-amd64
linux-arm64
VERBOSE_NOTIFICATIONS: ${{ fromJSON(needs.configuration.outputs.COOKIECUTTER_CONFIGURATION)._GITHUB_CI_DEFAULT_VERBOSE_NOTIFICATIONS }}
WORKFLOW_NAME: "container"
WORKFLOW_NAME: "utilities-container"

success:
needs:
Expand All @@ -160,4 +159,4 @@ jobs:
with:
NOTIFICATION_EMOJI: ":checkered_flag:"
NOTIFICATION_MESSAGE: "Multi-arch container build has completed successfully!"
WORKFLOW_NAME: "container"
WORKFLOW_NAME: "utilities-container"
1 change: 1 addition & 0 deletions .vale/Vocab/cicd-tools/accept.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
anchore
codebase's
gettext
mac_maker
tmate
Loading

0 comments on commit c286aa5

Please sign in to comment.