siderolabs/conform

docs: sample repository for GitHub Actions

sayanee opened this issue ยท 13 comments

Is there a sample .github/workflows/conform.yml file or a repository that is using conform for GitHub Actions? CI build seems to be failing for me because base name (${GOLANG_IMAGE}) should not be blank.

name: Conform
on: [push]
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
    - name: Conform Action
      uses: talos-systems/conform@v0.1.0-alpha.16
      env:
        GOLANG_IMAGE: golang:1.12.6

Hi @sayanee. Unfortunately GitHub changed their format since the last time I have tested. One thing you could do is use our pre-built docker image (https://cloud.docker.com/u/autonomy/repository/docker/autonomy/conform) and skip GitHub building the container. I know maybe not the best answer, but its a workaround until I can test with the new actions format.

Oops! Looks like it's giving me a 404 error:
image

Yes, it does seem that the formatting for GitHub Actions is still in flux. I'm also unsure of the yml syntax to pull a custom pre-built docker image (after some brief searching). Maybe I'll wait for a few more months until things are more stable.

Thanks a lot for this tool ๐Ÿ™ I'm using it locally with conform enforce and it works great!

@sayanee looks like you can do

uses: docker://autonomy/conform:v0.1.0-alpha.16

Reference: https://help.github.com/en/articles/workflow-syntax-for-github-actions

Also, the docker hub link is here: https://hub.docker.com/r/autonomy/conform
Looks like I had to click "Public View" in docker hub to get the correct link.

Thanks, @andrewrynhard! The docker pull seems to be successful now.

But there's an error on .conform.yaml not found even though the file exists on the root of the repository.

open .conform.yaml: no such file or directory
##[error]Docker run failed with exit code 1

The complete .github/workflows/conform.yml file now looks like:

name: Conform
on: [push]
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
    - name: Conform Action
      uses: docker://autonomy/conform:v0.1.0-alpha.16

Am I missing something minor? ๐Ÿค”

Looks like the working directory needs to be set? A local run seems to work just fine. This is likely something in the action definition that needs to be fixed.

[I] /t/scratch $ git clone https://github.com/hutscape/pine.git
Cloning into 'pine'...
remote: Enumerating objects: 386, done.
remote: Counting objects: 100% (386/386), done.
remote: Compressing objects: 100% (247/247), done.
remote: Total 726 (delta 225), reused 272 (delta 120), pack-reused 340
Receiving objects: 100% (726/726), 10.92 MiB | 1.31 MiB/s, done.
Resolving deltas: 100% (382/382), done.

[I] /t/scratch $ docker run --rm -v $PWD:/src/ -w /src autonomy/conform:v0.1.0-alpha.16
Unable to find image 'autonomy/conform:v0.1.0-alpha.16' locally
v0.1.0-alpha.16: Pulling from autonomy/conform
20ca0f86a434: Pull complete
7af7ff28817f: Pull complete
Digest: sha256:f3ceb30f6a7a93a582bc3ecf66b15037773b72fb4f0b374b24c04bb54dfc38b0
Status: Downloaded newer image for autonomy/conform:v0.1.0-alpha.16
open .conform.yaml: no such file or directory

[I] /t/scratch $ cd pine/

[I] /t/s/pine master (a39dad2) $ docker run --rm -v $PWD:/src/ -w /src autonomy/conform:v0.1.0-alpha.16
POLICY        CHECK                      STATUS        MESSAGE
commit        Conventional Commit        PASS          <none>
jwnx commented

@sayanee I was able to fix by calling actions/checkout first (:

    steps:
    - name: Checkout
      uses: actions/checkout@v1

    - name: Conform Action
      uses: docker://autonomy/conform:v0.1.0-alpha.16

@jwnx oh awesome! Thanks for digging into this.

@jwnx Thanks a lot ๐Ÿ™‡โ€โ™€ I finally got it to work ๐Ÿ˜„

I'm closing this issue.

Here's the successful CI run and the entire conform.yml file for future reference.

I have the same issue as Sayanee mentioned. I have tried using version 16 and 20 of the Docker image, as well as ' talos-systems/conform@v0.1.0-alpha.20'. Do you have new insight here?

bilde

@ekallevik Hmm. I do not. Can you share your action yaml?

Sure!

bilde

I personally don't use actions, and I know it has gone through a ton of change ... That seems okay to me. I am afraid I don't have any insight here ๐Ÿ˜ž .

It's okay! Thanks for looking into it