From 4ed6abb406e3ed0b39132ac15eb92e38b685482f Mon Sep 17 00:00:00 2001 From: Markus Pesch Date: Tue, 31 Aug 2021 22:39:00 +0200 Subject: [PATCH] fix: update ci --- .drone.yml | 121 ++++++++++++++++++++++++++++++++++--- .markdownlint.yaml | 144 +++++++++++++++++++++++++++++++++++++++++++++ Dockerfile | 50 +++++++--------- Makefile | 34 ++++------- README.md | 6 +- 5 files changed, 292 insertions(+), 63 deletions(-) create mode 100644 .markdownlint.yaml diff --git a/.drone.yml b/.drone.yml index 0b29996..677f7bf 100644 --- a/.drone.yml +++ b/.drone.yml @@ -1,12 +1,60 @@ +--- kind: pipeline -type: docker -name: build-image-x86_64 +type: kubernetes +name: linter + +platform: + os: linux + arch: amd64 steps: -- name: build-image-latest +- name: markdown lint + commands: + - markdownlint *.md + image: docker.io/tmknom/markdownlint:0.23.1 + resources: + limits: + cpu: 50 + memory: 50M + +- name: email-notification + environment: + PLUGIN_HOST: + from_secret: smtp_host + PLUGIN_USERNAME: + from_secret: smtp_username + PLUGIN_PASSWORD: + from_secret: smtp_password + PLUGIN_FROM: + from_secret: smtp_mail_address + image: docker.io/drillster/drone-email:latest + resources: + limits: + cpu: 50 + memory: 25M + when: + status: + - changed + - failure + +trigger: + event: + exclude: + - tag +--- +kind: pipeline +type: docker +name: build + +platform: + os: linux + arch: amd64 + +steps: +- name: build image: docker.io/volkerraschek/build-image:latest commands: - - make CONTAINER_RUNTIME=docker container-image/build + - make container-image/build CONTAINER_RUNTIME=docker volumes: - name: docker_socket path: /var/run/docker.sock @@ -14,12 +62,12 @@ steps: branch: - master -- name: push-image-latest +- name: push image: docker.io/volkerraschek/build-image:latest commands: - - make CONTAINER_RUNTIME=docker container-image/push + - make container-image/push CONTAINER_RUNTIME=docker environment: - CONTAINER_IMAGE_REGISTRY_PASSWORD: + BIND9_IMAGE_REGISTRY_PASSWORD: from_secret: container_image_registry_password volumes: - name: docker_socket @@ -27,11 +75,13 @@ steps: when: branch: - master + repo: + - volker.raschek/build-image -- name: delete-image-latest +- name: delete image: docker.io/volkerraschek/build-image:latest commands: - - make CONTAINER_RUNTIME=docker container-image/delete + - make container-image/delete CONTAINER_RUNTIME=docker volumes: - name: docker_socket path: /var/run/docker.sock @@ -59,3 +109,56 @@ volumes: - name: docker_socket host: path: /var/run/docker.sock + +trigger: + event: + exclude: + - tag +--- +kind: pipeline +type: kubernetes +name: sync + +platform: + os: linux + arch: amd64 + +steps: +- name: github + image: docker.io/appleboy/drone-git-push:latest + resources: + limits: + cpu: 50 + memory: 25M + settings: + branch: master + remote: ssh://git@github.com/volker-raschek/build-image.git + force: true + ssh_key: + from_secret: ssh_key + +- name: email-notification + environment: + PLUGIN_HOST: + from_secret: smtp_host + PLUGIN_USERNAME: + from_secret: smtp_username + PLUGIN_PASSWORD: + from_secret: smtp_password + PLUGIN_FROM: + from_secret: smtp_mail_address + image: docker.io/drillster/drone-email:latest + resources: + limits: + cpu: 50 + memory: 25M + when: + status: + - changed + - failure + +trigger: + event: + - push + repo: + - volker.raschek/build-image diff --git a/.markdownlint.yaml b/.markdownlint.yaml new file mode 100644 index 0000000..57b2fbf --- /dev/null +++ b/.markdownlint.yaml @@ -0,0 +1,144 @@ +# markdownlint YAML configuration +# https://github.com/DavidAnson/markdownlint/blob/main/schema/.markdownlint.yaml + +# Default state for all rules +default: true + +# Path to configuration file to extend +extends: null + +# MD003/heading-style/header-style - Heading style +MD003: + # Heading style + style: "atx" + +# MD004/ul-style - Unordered list style +MD004: + style: "dash" + +# MD007/ul-indent - Unordered list indentation +MD007: + # Spaces for indent + indent: 2 + # Whether to indent the first level of the list + start_indented: false + +# MD009/no-trailing-spaces - Trailing spaces +MD009: + # Spaces for line break + br_spaces: 2 + # Allow spaces for empty lines in list items + list_item_empty_lines: false + # Include unnecessary breaks + strict: false + +# MD010/no-hard-tabs - Hard tabs +MD010: + # Include code blocks + code_blocks: true + +# MD012/no-multiple-blanks - Multiple consecutive blank lines +MD012: + # Consecutive blank lines + maximum: 1 + +# MD013/line-length - Line length +MD013: + # Number of characters + line_length: 80 + # Number of characters for headings + heading_line_length: 80 + # Number of characters for code blocks + code_block_line_length: 80 + # Include code blocks + code_blocks: false + # Include tables + tables: false + # Include headings + headings: true + # Include headings + headers: true + # Strict length checking + strict: false + # Stern length checking + stern: false + +# MD022/blanks-around-headings/blanks-around-headers - Headings should be surrounded by blank lines +MD022: + # Blank lines above heading + lines_above: 1 + # Blank lines below heading + lines_below: 1 + +# MD024/no-duplicate-heading/no-duplicate-header - Multiple headings with the same content +MD024: + # Only check sibling headings + allow_different_nesting: true + +# MD025/single-title/single-h1 - Multiple top-level headings in the same document +MD025: + # Heading level + level: 1 + # RegExp for matching title in front matter + front_matter_title: "^\\s*title\\s*[:=]" + +# MD026/no-trailing-punctuation - Trailing punctuation in heading +MD026: + # Punctuation characters + punctuation: ".,;:!。,;:!" + +# MD029/ol-prefix - Ordered list item prefix +MD029: + # List style + style: "one_or_ordered" + +# MD030/list-marker-space - Spaces after list markers +MD030: + # Spaces for single-line unordered list items + ul_single: 1 + # Spaces for single-line ordered list items + ol_single: 1 + # Spaces for multi-line unordered list items + ul_multi: 1 + # Spaces for multi-line ordered list items + ol_multi: 1 + +# MD033/no-inline-html - Inline HTML +MD033: + # Allowed elements + allowed_elements: [] + +# MD035/hr-style - Horizontal rule style +MD035: + # Horizontal rule style + style: "---" + +# MD036/no-emphasis-as-heading/no-emphasis-as-header - Emphasis used instead of a heading +MD036: + # Punctuation characters + punctuation: ".,;:!?。,;:!?" + +# MD041/first-line-heading/first-line-h1 - First line in a file should be a top-level heading +MD041: + # Heading level + level: 1 + # RegExp for matching title in front matter + front_matter_title: "^\\s*title\\s*[:=]" + +# MD044/proper-names - Proper names should have the correct capitalization +MD044: + # List of proper names + names: [] + # - some-thing + # Include code blocks + code_blocks: false + +# MD046/code-block-style - Code block style +MD046: + # Block style + style: "fenced" + +# MD048/code-fence-style - Code fence style +MD048: + # Code fence syle + style: "backtick" \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 103b23a..be59ff0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,38 +1,30 @@ -ARG BASE_IMAGE +FROM docker.io/library/archlinux:latest -FROM ${BASE_IMAGE} - -RUN pacman --sync \ - --refresh \ - --noconfirm \ - --sysupgrade \ - awk \ - bash-completion \ - docker \ - gcc \ - git \ - go \ - make \ - podman \ - which \ - zip +RUN pacman --sync --refresh --noconfirm --sysupgrade \ + awk \ + bash-completion \ + docker \ + gcc \ + git \ + go \ + make \ + podman \ + which \ + zip COPY installation-scripts /tmp/installation-scripts # Install PKGs from own repo RUN /tmp/installation-scripts/00-pacman-mirror.sh -RUN pacman --sync \ - --refresh \ - --noconfirm \ - --sysupgrade \ - docker-pushrm \ - oracle-instantclient-basic \ - oracle-instantclient-jdbc \ - oracle-instantclient-odbc \ - oracle-instantclient-sdk \ - oracle-instantclient-sqlplus \ - oracle-instantclient-tools \ - rpm-builder +RUN pacman --sync --refresh --noconfirm --sysupgrade \ + docker-pushrm \ + oracle-instantclient-basic \ + oracle-instantclient-jdbc \ + oracle-instantclient-odbc \ + oracle-instantclient-sdk \ + oracle-instantclient-sqlplus \ + oracle-instantclient-tools \ + rpm-builder ENV PATH="/root/.cargo/bin:/root/go/bin:${PATH}" diff --git a/Makefile b/Makefile index c187a7c..58ec842 100644 --- a/Makefile +++ b/Makefile @@ -3,51 +3,41 @@ # container runtime. This is needed to start and run a container image. CONTAINER_RUNTIME?=$(shell which podman) -# BASE_IMAGE -# Defines the name of the container base image on which should be built the new -# CONTAINER_IMAGE. -BASE_IMAGE_REGISTRY_HOST:=docker.io -BASE_IMAGE_NAMESPACE:=archlinux -BASE_IMAGE_REPOSITORY:=base -BASE_IMAGE_VERSION:=latest -BASE_IMAGE_FULLY_QUALIFIED=${BASE_IMAGE_REGISTRY_HOST}/${BASE_IMAGE_NAMESPACE}/${BASE_IMAGE_REPOSITORY}:${BASE_IMAGE_VERSION} - # CONTAINER_IMAGE # Defines the name of the new container to be built using several variables. -CONTAINER_IMAGE_REGISTRY_HOST:=docker.io -CONTAINER_IMAGE_REGISTRY_USER:=volkerraschek -CONTAINER_IMAGE_NAMESPACE?=${CONTAINER_IMAGE_REGISTRY_USER} -CONTAINER_IMAGE_REPOSITORY:=build-image -CONTAINER_IMAGE_VERSION?=latest -CONTAINER_IMAGE_FULLY_QUALIFIED=${CONTAINER_IMAGE_REGISTRY_HOST}/${CONTAINER_IMAGE_NAMESPACE}/${CONTAINER_IMAGE_REPOSITORY}:${CONTAINER_IMAGE_VERSION} -CONTAINER_IMAGE_UNQUALIFIED=${CONTAINER_IMAGE_NAMESPACE}/${CONTAINER_IMAGE_REPOSITORY}:${CONTAINER_IMAGE_VERSION} +BUILD_IMAGE_REGISTRY_HOST:=docker.io +BUILD_IMAGE_REGISTRY_USER:=volkerraschek +BUILD_IMAGE_NAMESPACE?=${BUILD_IMAGE_REGISTRY_USER} +BUILD_IMAGE_REPOSITORY:=build-image +BUILD_IMAGE_VERSION?=latest +BUILD_IMAGE_FULLY_QUALIFIED=${BUILD_IMAGE_REGISTRY_HOST}/${BUILD_IMAGE_NAMESPACE}/${BUILD_IMAGE_REPOSITORY}:${BUILD_IMAGE_VERSION} +BUILD_IMAGE_UNQUALIFIED=${BUILD_IMAGE_NAMESPACE}/${BUILD_IMAGE_REPOSITORY}:${BUILD_IMAGE_VERSION} # BUILD CONTAINER IMAGE # ============================================================================== PHONY:=container-image/build container-image/build: ${CONTAINER_RUNTIME} build \ - --build-arg BASE_IMAGE=${BASE_IMAGE_FULLY_QUALIFIED} \ --file Dockerfile \ --no-cache \ --pull \ - --tag ${CONTAINER_IMAGE_FULLY_QUALIFIED} \ - --tag ${CONTAINER_IMAGE_UNQUALIFIED} \ + --tag ${BUILD_IMAGE_FULLY_QUALIFIED} \ + --tag ${BUILD_IMAGE_UNQUALIFIED} \ . # DELETE CONTAINER IMAGE # ============================================================================== PHONY:=container-image/delete container-image/delete: - - ${CONTAINER_RUNTIME} image rm ${CONTAINER_IMAGE_FULLY_QUALIFIED} ${CONTAINER_IMAGE_UNQUALIFIED} + - ${CONTAINER_RUNTIME} image rm ${BUILD_IMAGE_FULLY_QUALIFIED} ${BUILD_IMAGE_UNQUALIFIED} - ${CONTAINER_RUNTIME} image rm ${BASE_IMAGE_FULLY_QUALIFIED} # PUSH CONTAINER IMAGE # ============================================================================== PHONY+=container-image/push container-image/push: - ${CONTAINER_RUNTIME} login ${CONTAINER_IMAGE_REGISTRY_HOST} --username ${CONTAINER_IMAGE_REGISTRY_USER} --password ${CONTAINER_IMAGE_REGISTRY_PASSWORD} - ${CONTAINER_RUNTIME} push ${CONTAINER_IMAGE_FULLY_QUALIFIED} + ${CONTAINER_RUNTIME} login ${BUILD_IMAGE_REGISTRY_HOST} --username ${BUILD_IMAGE_REGISTRY_USER} --password ${BUILD_IMAGE_REGISTRY_PASSWORD} + ${CONTAINER_RUNTIME} push ${BUILD_IMAGE_FULLY_QUALIFIED} # PHONY # ============================================================================== diff --git a/README.md b/README.md index d38edec..ac4949c 100644 --- a/README.md +++ b/README.md @@ -3,9 +3,9 @@ [![Build Status](https://drone.cryptic.systems/api/badges/volker.raschek/build-image/status.svg)](https://drone.cryptic.systems/volker.raschek/build-image) [![Docker Pulls](https://img.shields.io/docker/pulls/volkerraschek/build-image)](https://hub.docker.com/r/volkerraschek/build-image) -This project, hosted on -[git.cryptic.systems](https://git.cryptic.systems/volker.raschek/build-image), -contains only files to build a build container image. +This project contains all sources to build the container image +`docker.io/volkerraschek/build-image`. The primary goal of the image is only +to provide an environment to compile source code like go or rust. ## Usage