From 6ca402015eac6295b44715e6b23f0eaff554e961 Mon Sep 17 00:00:00 2001 From: Ross Ceballo Date: Mon, 12 Aug 2024 18:36:24 +0000 Subject: [PATCH 1/6] Add github action to repo --- .github/workflows/markdownlint.yaml | 16 ++++++++++++++++ .github/workflows/rebase_checker.yaml | 8 ++++++++ .github/workflows/shellcheck.yaml | 17 +++++++++++++++++ .github/workflows/yamllint.yaml | 24 ++++++++++++++++++++++++ 4 files changed, 65 insertions(+) create mode 100644 .github/workflows/markdownlint.yaml create mode 100644 .github/workflows/rebase_checker.yaml create mode 100644 .github/workflows/shellcheck.yaml create mode 100644 .github/workflows/yamllint.yaml diff --git a/.github/workflows/markdownlint.yaml b/.github/workflows/markdownlint.yaml new file mode 100644 index 0000000..29f1408 --- /dev/null +++ b/.github/workflows/markdownlint.yaml @@ -0,0 +1,16 @@ +name: Lint Markdown Files + +on: + push: + branches: + - main + pull_request: + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - name: Check out code + uses: actions/checkout@v2 + - name: Run linter + uses: actionshub/markdownlint@main diff --git a/.github/workflows/rebase_checker.yaml b/.github/workflows/rebase_checker.yaml new file mode 100644 index 0000000..62aeca7 --- /dev/null +++ b/.github/workflows/rebase_checker.yaml @@ -0,0 +1,8 @@ +--- +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/shellcheck.yaml b/.github/workflows/shellcheck.yaml new file mode 100644 index 0000000..ba7fbb9 --- /dev/null +++ b/.github/workflows/shellcheck.yaml @@ -0,0 +1,17 @@ +name: shellcheck + +on: + push: + branches: + - main + pull_request: + +jobs: + shellcheck: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - name: Run shellcheck + uses: ludeeus/action-shellcheck@master + # See https://github.com/ludeeus/action-shellcheck for customizations diff --git a/.github/workflows/yamllint.yaml b/.github/workflows/yamllint.yaml new file mode 100644 index 0000000..cb174aa --- /dev/null +++ b/.github/workflows/yamllint.yaml @@ -0,0 +1,24 @@ +name: Lint YAML Files + +on: + push: + branches: + - main + pull_request: + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: 3.7 + + - name: Install + run: pip install yamllint + + - name: Run linter + run: yamllint . From f16c6c9760b4f3ee85d5c1cdac5c8e8e1fbcdbc2 Mon Sep 17 00:00:00 2001 From: Ross Ceballo Date: Mon, 12 Aug 2024 21:43:01 +0000 Subject: [PATCH 2/6] Add docker build for arm64 --- .github/workflows/build.yaml | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 .github/workflows/build.yaml diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml new file mode 100644 index 0000000..2ad1e1e --- /dev/null +++ b/.github/workflows/build.yaml @@ -0,0 +1,30 @@ +name: ci + +on: + push: + branches: + - master + +jobs: + docker: + runs-on: ubuntu-latest + steps: + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build and push + uses: docker/build-push-action@v6 + with: + platforms: linux/amd64,linux/arm64 + push: true + tags: ghcr.io/${{ github.repository }} From 08f34c82f33bcf602f730e664b1ac87bc988ad1b Mon Sep 17 00:00:00 2001 From: Ross Ceballo Date: Tue, 13 Aug 2024 00:59:25 +0000 Subject: [PATCH 3/6] Remove unused test and travis files --- .hadolint.yaml | 10 ---------- .travis.yml | 32 -------------------------------- Makefile | 5 ----- tests/hadolint.sh | 28 ---------------------------- tests/make.sh | 31 ------------------------------- tests/mdl.sh | 26 -------------------------- tests/shellcheck.sh | 26 -------------------------- tests/yamllint.sh | 38 -------------------------------------- 8 files changed, 196 deletions(-) delete mode 100644 .hadolint.yaml delete mode 100644 .travis.yml delete mode 100644 Makefile delete mode 100755 tests/hadolint.sh delete mode 100755 tests/make.sh delete mode 100755 tests/mdl.sh delete mode 100755 tests/shellcheck.sh delete mode 100755 tests/yamllint.sh diff --git a/.hadolint.yaml b/.hadolint.yaml deleted file mode 100644 index 7411973..0000000 --- a/.hadolint.yaml +++ /dev/null @@ -1,10 +0,0 @@ ---- -ignored: - # disable USER root - - DL3002 - # disable pinning apk package versions - - DL3018 - # disable following sourced files - - SC1091 - # disable JSON style CMD - - DL3025 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/Makefile b/Makefile deleted file mode 100644 index 84a92af..0000000 --- a/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -all: build - -build: - docker build \ - -t lsstsqre/docker-gc . 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 From 52531ecfba8f9689e071782c54d12ae36f1a9a94 Mon Sep 17 00:00:00 2001 From: Ross Ceballo Date: Tue, 13 Aug 2024 01:00:32 +0000 Subject: [PATCH 4/6] Updated Readme --- .github/workflows/markdownlint.yaml | 2 +- .github/workflows/shellcheck.yaml | 2 +- .github/workflows/yamllint.yaml | 2 +- README.md | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/markdownlint.yaml b/.github/workflows/markdownlint.yaml index 29f1408..d4e709b 100644 --- a/.github/workflows/markdownlint.yaml +++ b/.github/workflows/markdownlint.yaml @@ -11,6 +11,6 @@ jobs: runs-on: ubuntu-latest steps: - name: Check out code - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Run linter uses: actionshub/markdownlint@main diff --git a/.github/workflows/shellcheck.yaml b/.github/workflows/shellcheck.yaml index ba7fbb9..3db5631 100644 --- a/.github/workflows/shellcheck.yaml +++ b/.github/workflows/shellcheck.yaml @@ -10,7 +10,7 @@ jobs: shellcheck: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Run shellcheck uses: ludeeus/action-shellcheck@master diff --git a/.github/workflows/yamllint.yaml b/.github/workflows/yamllint.yaml index cb174aa..680ceae 100644 --- a/.github/workflows/yamllint.yaml +++ b/.github/workflows/yamllint.yaml @@ -10,7 +10,7 @@ jobs: lint: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Set up Python uses: actions/setup-python@v2 diff --git a/README.md b/README.md index 73ee40d..caf75d2 100644 --- a/README.md +++ b/README.md @@ -11,5 +11,5 @@ Usage --- ```sh -docker run -ti lsstsqre/docker-gc +docker run -ti ghcr.io/lsst-dm/docker-docker-gc ``` From fad467c8c19135086bf85180e25f8719c9e3f947 Mon Sep 17 00:00:00 2001 From: Ross Ceballo Date: Tue, 13 Aug 2024 01:00:11 +0000 Subject: [PATCH 5/6] Fix yaml linting --- .github/workflows/build.yaml | 4 +++- .github/workflows/markdownlint.yaml | 10 +++------- .github/workflows/shellcheck.yaml | 17 ----------------- .github/workflows/yamllint.yaml | 18 +++--------------- .yamllint | 5 +++++ 5 files changed, 14 insertions(+), 40 deletions(-) delete mode 100644 .github/workflows/shellcheck.yaml create mode 100644 .yamllint diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 2ad1e1e..d837432 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -1,9 +1,11 @@ +--- name: ci on: push: branches: - master + - main jobs: docker: @@ -27,4 +29,4 @@ jobs: with: platforms: linux/amd64,linux/arm64 push: true - tags: ghcr.io/${{ github.repository }} + tags: ghcr.io/${{ github.repository }}:latest diff --git a/.github/workflows/markdownlint.yaml b/.github/workflows/markdownlint.yaml index d4e709b..e6685c0 100644 --- a/.github/workflows/markdownlint.yaml +++ b/.github/workflows/markdownlint.yaml @@ -1,3 +1,4 @@ +--- name: Lint Markdown Files on: @@ -7,10 +8,5 @@ on: pull_request: jobs: - lint: - runs-on: ubuntu-latest - steps: - - name: Check out code - uses: actions/checkout@v4 - - name: Run linter - uses: actionshub/markdownlint@main + call-workflow: + uses: lsst/rubin_workflows/.github/workflows/markdownlint.yaml@main diff --git a/.github/workflows/shellcheck.yaml b/.github/workflows/shellcheck.yaml deleted file mode 100644 index 3db5631..0000000 --- a/.github/workflows/shellcheck.yaml +++ /dev/null @@ -1,17 +0,0 @@ -name: shellcheck - -on: - push: - branches: - - main - pull_request: - -jobs: - shellcheck: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - - name: Run shellcheck - uses: ludeeus/action-shellcheck@master - # See https://github.com/ludeeus/action-shellcheck for customizations diff --git a/.github/workflows/yamllint.yaml b/.github/workflows/yamllint.yaml index 680ceae..aec968a 100644 --- a/.github/workflows/yamllint.yaml +++ b/.github/workflows/yamllint.yaml @@ -1,3 +1,4 @@ +--- name: Lint YAML Files on: @@ -7,18 +8,5 @@ on: pull_request: jobs: - lint: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - - name: Set up Python - uses: actions/setup-python@v2 - with: - python-version: 3.7 - - - name: Install - run: pip install yamllint - - - name: Run linter - run: yamllint . + call-workflow: + uses: lsst/rubin_workflows/.github/workflows/yamllint.yaml@main diff --git a/.yamllint b/.yamllint new file mode 100644 index 0000000..7214609 --- /dev/null +++ b/.yamllint @@ -0,0 +1,5 @@ +--- +extends: default +rules: + truthy: + check-keys: false From a5475b753bad3c672767ec17ab6ae5688c677d89 Mon Sep 17 00:00:00 2001 From: Ross Ceballo Date: Tue, 13 Aug 2024 17:02:13 -0400 Subject: [PATCH 6/6] Add lsst-dm/build-and-push for github actions --- .github/workflows/build.yaml | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index d837432..11f2be0 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -4,29 +4,20 @@ name: ci on: push: branches: - - master - main + pull_request: jobs: docker: runs-on: ubuntu-latest steps: - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - - name: Login to GitHub Container Registry - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.repository_owner }} - password: ${{ secrets.GITHUB_TOKEN }} - + - name: Checkout + uses: actions/checkout@v4 - name: Build and push - uses: docker/build-push-action@v6 + uses: lsst-dm/build-and-push@main + id: build with: + github_token: ${{ secrets.GITHUB_TOKEN }} platforms: linux/amd64,linux/arm64 + image: ${{ github.repository }} push: true - tags: ghcr.io/${{ github.repository }}:latest