From e8237f9b023f519607ba81ab6814f1eed3e0fc9f Mon Sep 17 00:00:00 2001 From: Stephen Fox Jr Date: Wed, 10 Nov 2021 17:23:52 -0500 Subject: [PATCH 01/10] Initial GitHub Actions migration. --- .github/workflows/ci.yaml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 .github/workflows/ci.yaml diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000..0a490b2 --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,24 @@ +name: ci +on: + push: + pull_request: + +jobs: + pylama: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-python@v2 + with: + python-version: '3.8' + - run: pip install pylama + - run: pylama packethardware setup.py + black: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-python@v2 + with: + python-version: '3.8' + - run: pip install black + - run: black --check --diff . From 3fbb8c664437abb086422da15361f6319cc84300 Mon Sep 17 00:00:00 2001 From: Stephen Fox Jr Date: Thu, 11 Nov 2021 14:19:54 -0500 Subject: [PATCH 02/10] Initial take on Docker image build / push GHA. --- .github/workflows/ci.yaml | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 0a490b2..ae4bcc1 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -22,3 +22,38 @@ jobs: python-version: '3.8' - run: pip install black - run: black --check --diff . + publish-docker-image: + name: build image and possibly push image to quay.io + runs-on: ubuntu-latest + needs: [pylama, black] + steps: + - uses: actions/checkout@v2 + - uses: docker/setup-buildx-action@v1 + id: buildx + - uses: docker/metadata-action@v3 + id: meta + with: + images: quay.io/packet/packet-hardware + tags: | + type=sha + type=ref,event=branch + - uses: docker/login-action@v1 + if: github.event_name == 'create' && github.event.ref_type == 'tag' + with: + registry: quay.io + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + - uses: actions/cache@v2 + with: + path: /tmp/.buildx-cache + key: ${{ runner.os }}-cache + restore-keys: | + ${{ runner.os }}-cache + - uses: docker/build-push-action@v2 + with: + platforms: linux/amd64 + push: ${{ github.event_name == 'create' && github.event.ref_type == 'tag' }} + tags: ${{ steps.meta.outputs.tags }} + cache-from: type=local,src=/tmp/.buildx-cache + cache-to: type=local,dest=/tmp/.buildx-cache + builder: ${{ steps.buildx.outputs.name }} From 24f859b410ed30d38f5dbf730f846ede05879084 Mon Sep 17 00:00:00 2001 From: Stephen Fox Jr Date: Thu, 11 Nov 2021 15:17:34 -0500 Subject: [PATCH 03/10] Checkout LFS objects in Docker image CI job. --- .github/workflows/ci.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index ae4bcc1..e9d6898 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -28,6 +28,8 @@ jobs: needs: [pylama, black] steps: - uses: actions/checkout@v2 + with: + lfs: 'true' - uses: docker/setup-buildx-action@v1 id: buildx - uses: docker/metadata-action@v3 From 3232c803584b3799ef4927e0ad219a889c80196a Mon Sep 17 00:00:00 2001 From: Stephen Fox Jr Date: Fri, 12 Nov 2021 10:55:44 -0500 Subject: [PATCH 04/10] Possible work around for LFS CI issue. --- .github/workflows/ci.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index e9d6898..b21d3f5 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -30,6 +30,7 @@ jobs: - uses: actions/checkout@v2 with: lfs: 'true' + - run: git lfs checkout - uses: docker/setup-buildx-action@v1 id: buildx - uses: docker/metadata-action@v3 From 058ec1280e16a53dcb8155946493530fc33db8a6 Mon Sep 17 00:00:00 2001 From: Stephen Fox Jr Date: Fri, 12 Nov 2021 11:20:23 -0500 Subject: [PATCH 05/10] Override Docker build-push context behavior. Per the "docker/build-push-action" documentation, any changes made to files preceding this Action will be discarded / ignored. As a result, any resolved git LFS files will be ignored. Because the repo. contains one or more git LFS'ed tar file, the file(s) created by the "checkout" action will be returned to LFS pointer text files when the "build-push" action runs. This does not bode well for the Docker image build process, which attempts to untar said pointer files. Refer to the following URLs for more information: - https://github.com/docker/build-push-action/#usage - https://stackoverflow.com/a/66453723 --- .github/workflows/ci.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index b21d3f5..45d6ba8 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -57,6 +57,7 @@ jobs: platforms: linux/amd64 push: ${{ github.event_name == 'create' && github.event.ref_type == 'tag' }} tags: ${{ steps.meta.outputs.tags }} + context: '.' cache-from: type=local,src=/tmp/.buildx-cache cache-to: type=local,dest=/tmp/.buildx-cache builder: ${{ steps.buildx.outputs.name }} From 95d836b66fb60bc2d2c6faa10a33654e21ba55f3 Mon Sep 17 00:00:00 2001 From: Stephen Fox Jr Date: Fri, 12 Nov 2021 11:41:11 -0500 Subject: [PATCH 06/10] Removed (possibly) unnecessary "git lfs checkout". --- .github/workflows/ci.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 45d6ba8..e758731 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -30,7 +30,6 @@ jobs: - uses: actions/checkout@v2 with: lfs: 'true' - - run: git lfs checkout - uses: docker/setup-buildx-action@v1 id: buildx - uses: docker/metadata-action@v3 From b4dea611f15e5f422ab3c6fb97c2ac23aa417ad4 Mon Sep 17 00:00:00 2001 From: Stephen Fox Jr Date: Fri, 12 Nov 2021 11:46:42 -0500 Subject: [PATCH 07/10] Renamed Docker build and push CI job for clarity. --- .github/workflows/ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index e758731..0a86e39 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -22,7 +22,7 @@ jobs: python-version: '3.8' - run: pip install black - run: black --check --diff . - publish-docker-image: + build-and-publish-docker-image: name: build image and possibly push image to quay.io runs-on: ubuntu-latest needs: [pylama, black] From d36480d2dcabe301efaf5cc7fa3e2474b75debc9 Mon Sep 17 00:00:00 2001 From: Stephen Fox Jr Date: Fri, 12 Nov 2021 11:47:19 -0500 Subject: [PATCH 08/10] Attempt to tag Docker image with git tag in CI. The "docker/metadata" Action is pretty unclear about this... Refer to the following URL for more information: - https://github.com/docker/metadata-action#tags-input --- .github/workflows/ci.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 0a86e39..2f818cb 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -37,6 +37,7 @@ jobs: with: images: quay.io/packet/packet-hardware tags: | + type=ref,event=tag type=sha type=ref,event=branch - uses: docker/login-action@v1 From 1ed8182552295172f9acc71f4efc0d4918f5fae4 Mon Sep 17 00:00:00 2001 From: Stephen Fox Jr Date: Fri, 12 Nov 2021 11:54:25 -0500 Subject: [PATCH 09/10] Removed defunct drone CI config. --- .drone.yml | 38 -------------------------------------- 1 file changed, 38 deletions(-) delete mode 100644 .drone.yml diff --git a/.drone.yml b/.drone.yml deleted file mode 100644 index 80f0f61..0000000 --- a/.drone.yml +++ /dev/null @@ -1,38 +0,0 @@ -clone: - git: - image: quay.io/packet/drone-git - -# matrix: -# PYTHON_VERSION: -# - 3.5 -# - 3.6 -# - 3.7 -# - 3.8 - -pipeline: - pylama: - image: python:3.8-alpine - commands: - - pip install pylama - - pylama packethardware setup.py - black: - image: python:3.8-buster - commands: - - pip install black - - black --check --diff . -# test: -# image: python:${PYTHON_VERSION} -# commands: -# - pip install tox -# - tox -e py$(echo ${PYTHON_VERSION} | sed 's|\.||') - publish-image: - group: publish - image: plugins/docker - registry: quay.io - repo: quay.io/packet/packet-hardware - tags: - - ${DRONE_TAG} - - latest - secrets: [docker_username, docker_password] - when: - event: tag From b59bcefed8009f80d9736b3ae6e06389315939ca Mon Sep 17 00:00:00 2001 From: Stephen Fox Jr Date: Fri, 12 Nov 2021 12:20:56 -0500 Subject: [PATCH 10/10] Replaced defunct drone CI README badge. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 1060ac2..da43c47 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Equinix Metal Hardware -[![Build Status](https://cloud.drone.io/api/badges/packethost/packet-hardware/status.svg?ref=refs/heads/master)](https://cloud.drone.io/packethost/packet-hardware) ![](https://img.shields.io/badge/Stability-Experimental-red.svg) +![Continuous Integration](https://github.com/packethost/packet-hardware/actions/workflows/ci.yaml/badge.svg) This is a tool which is used within [OSIE](https://github.com/tinkerbell/osie) to audit hardware components to keep track of components that may need updating