diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 1befdfc..afe2fe8 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -2,7 +2,7 @@ name: Build Jenkins swarm client container on: push: branches: - - master + - main pull_request: env: @@ -15,26 +15,15 @@ jobs: packages: write contents: read steps: - - name: Checkout - uses: actions/checkout@v3 - - - name: Build swarm image - run: | - docker build . \ - --build-arg JSWARM_UID=48435 \ - --build-arg JSWARM_GID=202 \ - --tag $CONTAINER_NAME \ - --label "runnumber=${GITHUB_RUN_ID}" - - name: Log in to GitHub Container Registry - run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin - - - name: Push images - run: | - CONTAINER_ID=ghcr.io/${{ github.repository_owner }}/$CONTAINER_NAME - VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,') - [[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//') - [ "$VERSION" == "master" ] && VERSION=latest - echo CONTAINER_ID=$CONTAINER_ID - echo VERSION=$VERSION - docker tag $CONTAINER_NAME $CONTAINER_ID:$VERSION - docker push $CONTAINER_ID:$VERSION + - name: Checkout + uses: actions/checkout@v4 + - name: Build and push + uses: lsst-dm/build-and-push@main + with: + platforms: linux/amd64,linux/arm64 + github_token: ${{ secrets.GITHUB_TOKEN }} + push: true + build-args: | + JSWARM_UID=48435 + JSWARM_GID=202 + labels: runnumber=${{ github.run_id }} diff --git a/.github/workflows/markdownlint.yaml b/.github/workflows/markdownlint.yaml new file mode 100644 index 0000000..04dc554 --- /dev/null +++ b/.github/workflows/markdownlint.yaml @@ -0,0 +1,11 @@ +name: Lint Markdown Files + +on: + push: + branches: + - main + pull_request: + +jobs: + call-workflow: + uses: lsst/rubin_workflows/.github/workflows/markdownlint.yaml@main diff --git a/.github/workflows/rebase_checker.yaml b/.github/workflows/rebase_checker.yaml new file mode 100644 index 0000000..65516d9 --- /dev/null +++ b/.github/workflows/rebase_checker.yaml @@ -0,0 +1,7 @@ +name: Check that 'main' is not merged into the development branch + +on: pull_request + +jobs: + call-workflow: + uses: lsst/rubin_workflows/.github/workflows/rebase_checker.yaml@main diff --git a/.github/workflows/yamllint.yaml b/.github/workflows/yamllint.yaml new file mode 100644 index 0000000..5962342 --- /dev/null +++ b/.github/workflows/yamllint.yaml @@ -0,0 +1,8 @@ +name: Lint YAML Files + +on: + pull_request: + +jobs: + call-workflow: + uses: lsst/rubin_workflows/.github/workflows/yamllint.yaml@main diff --git a/.hadolint.yaml b/.hadolint.yaml deleted file mode 100644 index 179e48f..0000000 --- a/.hadolint.yaml +++ /dev/null @@ -1,8 +0,0 @@ ---- -ignored: - # disable USER root - - DL3002 - # disable pinning apk package versions - - DL3018 - # disable following sourced files - - SC1091 diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 338cce8..0000000 --- a/.travis.yml +++ /dev/null @@ -1,32 +0,0 @@ ---- -sudo: false -language: c -matrix: - include: - - &docker - env: TEST=markdownlint - services: - - docker - script: ./tests/mdl.sh - - - <<: *docker - env: TEST=yamllint - script: ./tests/yamllint.sh - - - <<: *docker - env: TEST=shellcheck - script: ./tests/shellcheck.sh - - - <<: *docker - env: TEST=hadolint - script: ./tests/hadolint.sh - - - env: TEST=make - script: ./tests/make.sh -branches: - only: - - master - # also matched against tag pushes - - /^\d+\.\d+\.\d+$/ -notifications: - email: false diff --git a/.yamllint b/.yamllint new file mode 100644 index 0000000..9fad077 --- /dev/null +++ b/.yamllint @@ -0,0 +1,4 @@ +extends: default +rules: + truthy: + check-keys: false diff --git a/Dockerfile b/Dockerfile index 2ff119f..63d1b35 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ # # download swarm jar # -FROM alpine:3 as downloader +FROM alpine:3 AS downloader ARG JSWARM_VERSION=3.46 ARG JSWARM_JAR_NAME=swarm-client-${JSWARM_VERSION}.jar @@ -19,7 +19,7 @@ RUN curl -sSLo /${JMXEX_JAR_NAME} ${JMXEX_URL} # # pkg base # -FROM alpine:3 as pkg_base +FROM alpine:3 AS pkg_base RUN apk add --no-cache --upgrade openjdk21 bash git docker make diff --git a/Makefile b/Makefile deleted file mode 100644 index bd9a690..0000000 --- a/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -all: build - -build: - docker build \ - -t lsstsqre/jenkins-swarm-client . - -ldfc: - docker build \ - --build-arg JSWARM_UID=48435 \ - --build-arg JSWARM_GID=202 \ - -t lsstsqre/jenkins-swarm-client:ldfc . diff --git a/README.md b/README.md index ba19f3c..12e59f7 100644 --- a/README.md +++ b/README.md @@ -10,5 +10,5 @@ Usage --- ```sh -docker run -ti lsstsqre/jenkins-swarm-client +docker run -ti ghcr.io/lsst-dm/jenkins-swarm-client ``` diff --git a/tests/hadolint.sh b/tests/hadolint.sh deleted file mode 100755 index fb8b19a..0000000 --- a/tests/hadolint.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/bash - -set -e -shopt -s globstar nullglob - -CHECK=( **/Dockerfile ) -IGNORE=() - -for c in "${!CHECK[@]}"; do - for i in "${IGNORE[@]}"; do - [[ ${CHECK[c]} == "$i" ]] && unset -v 'CHECK[c]' - done -done -[[ ${#CHECK[@]} -eq 0 ]] && { echo 'no files to check'; exit 0; } - -echo '---' -echo 'check:' -for c in "${CHECK[@]}"; do - echo " - ${c}" -done -echo - -for f in "${CHECK[@]}"; do - docker run -ti -v "$(pwd):$(pwd)" -w "$(pwd)" \ - hadolint/hadolint:v1.13.0 hadolint "$f" -done - -# vim: tabstop=2 shiftwidth=2 expandtab diff --git a/tests/make.sh b/tests/make.sh deleted file mode 100755 index 341d206..0000000 --- a/tests/make.sh +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/bash - -set -e -shopt -s globstar nullglob - -CHECK=( **/Makefile ) -IGNORE=() - -for c in "${!CHECK[@]}"; do - for i in "${IGNORE[@]}"; do - [[ ${CHECK[c]} == "$i" ]] && unset -v 'CHECK[c]' - done -done -[[ ${#CHECK[@]} -eq 0 ]] && { echo 'no files to check'; exit 0; } - -echo '---' -echo 'check:' -for c in "${CHECK[@]}"; do - echo " - ${c}" -done -echo - -for f in "${CHECK[@]}"; do - ( set -e - cd "$(dirname "$f")" - echo "checking $f" - make --dry-run --warn-undefined-variables - ) -done - -# vim: tabstop=2 shiftwidth=2 expandtab diff --git a/tests/mdl.sh b/tests/mdl.sh deleted file mode 100755 index 40fa8e6..0000000 --- a/tests/mdl.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash - -set -e -shopt -s globstar nullglob - -CHECK=( **/*.md ) -IGNORE=() - -for c in "${!CHECK[@]}"; do - for i in "${IGNORE[@]}"; do - [[ ${CHECK[c]} == "$i" ]] && unset -v 'CHECK[c]' - done -done -[[ ${#CHECK[@]} -eq 0 ]] && { echo 'no files to check'; exit 0; } - -echo '---' -echo 'check:' -for c in "${CHECK[@]}"; do - echo " - ${c}" -done -echo - -docker run -ti -v "$(pwd):$(pwd)" -w "$(pwd)" \ - mivok/markdownlint:0.4.0 "${CHECK[@]}" - -# vim: tabstop=2 shiftwidth=2 expandtab diff --git a/tests/shellcheck.sh b/tests/shellcheck.sh deleted file mode 100755 index f067e9f..0000000 --- a/tests/shellcheck.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash - -set -e -shopt -s globstar nullglob - -CHECK=( **/*.sh ) -IGNORE=( {environments,.bundle,.tmp}/** ) - -for c in "${!CHECK[@]}"; do - for i in "${IGNORE[@]}"; do - [[ ${CHECK[c]} == "$i" ]] && unset -v 'CHECK[c]' - done -done -[[ ${#CHECK[@]} -eq 0 ]] && { echo 'no files to check'; exit 0; } - -echo '---' -echo 'check:' -for c in "${CHECK[@]}"; do - echo " - ${c}" -done -echo - -docker run -ti -v "$(pwd):$(pwd)" -w "$(pwd)" \ - koalaman/shellcheck-alpine:v0.6.0 shellcheck -x "${CHECK[@]}" - -# vim: tabstop=2 shiftwidth=2 expandtab diff --git a/tests/yamllint.sh b/tests/yamllint.sh deleted file mode 100755 index dfa18ba..0000000 --- a/tests/yamllint.sh +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/bash - -set -e -shopt -s globstar nullglob - -CHECK=( **/*.{yaml,yml,.eyaml} .*.{yml,yaml} ) -EYAML=( **/*.eyaml ) -IGNORE=() -CONF_FILE=".yamllint.yaml" - -# filter out plain text versions of .eyaml files -for e in "${!EYAML[@]}"; do - uneyaml=${EYAML[e]/eyaml/yaml} - for c in "${!CHECK[@]}"; do - [[ ${CHECK[c]} == "$uneyaml" ]] && unset -v 'CHECK[c]' - done -done - -for c in "${!CHECK[@]}"; do - for i in "${IGNORE[@]}"; do - [[ ${CHECK[c]} == "$i" ]] && unset -v 'CHECK[c]' - done -done -[[ ${#CHECK[@]} -eq 0 ]] && { echo 'no files to check'; exit 0; } - -echo '---' -echo 'check:' -for c in "${CHECK[@]}"; do - echo " - ${c}" -done -echo - -ARGS=() -[[ -f $CONF_FILE ]] && ARGS+=(-c "$CONF_FILE") -ARGS+=("${CHECK[@]}") -docker run -ti -v "$(pwd):/workdir" lsstsqre/yamllint:1.13.0 "${ARGS[@]}" - -# vim: tabstop=2 shiftwidth=2 expandtab