Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Future autobuilds #66

Closed
m1k1o opened this issue Jun 8, 2021 · 5 comments
Closed

Future autobuilds #66

m1k1o opened this issue Jun 8, 2021 · 5 comments

Comments

@m1k1o
Copy link
Owner

m1k1o commented Jun 8, 2021

As one of the users of Docker Hub’s Autobuild service, we wanted to reach out and let you know that from June 18th, 2021 users on the free plan will no longer have access to the Autobuild feature. This means that any of your currently configured Autobuild will fail to run and you will need to upgrade to a Pro or Team account to restore functionality.

Need to find a way how to keep autobuilds work.

@mbattista
Copy link
Contributor

@m1k1o
Copy link
Owner Author

m1k1o commented Jun 8, 2021

That'd be also a good idea. Thanks, gonna try that.

@m1k1o
Copy link
Owner Author

m1k1o commented Jun 12, 2021

Came up with this (not tested yet). But I feel like, there is too much repetition. I am considering creating one automatic script that would loop through the .m1k1o/ directory and push everything. Or at least having it somwehere in script written, what would be built.

name: "CI for builds"

on:
  push:
    branches: [ dev ]

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - name: Check Out Repo
        uses: actions/checkout@v2

      - name: Login to Docker Hub
        run: |
          docker login --username ${DOCKERHUB_USERNAME} --password-stdin <<< "${DOCKERHUB_TOKEN}"
        env:
          DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
          DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}

      - name: Build base
        run: |
          .m1k1o/build ${DOCKER_TAG}
          docker push m1k1o/neko:${DOCKER_TAG}
        env:
          DOCKER_TAG: base

      - name: Build firefox
        run: |
          .m1k1o/build ${DOCKER_TAG}
          docker push m1k1o/neko:${DOCKER_TAG}
          #
          # Push as well as :latest
          #
          docker tag m1k1o/neko:${DOCKER_TAG} m1k1o/neko:latest
          docker push m1k1o/neko:latest
        env:
          DOCKER_TAG: firefox

      - name: Build chromium
        run: |
          .m1k1o/build ${DOCKER_TAG}
          docker push m1k1o/neko:${DOCKER_TAG}
        env:
          DOCKER_TAG: chromium

      - name: Build google-chrome
        run: |
          .m1k1o/build ${DOCKER_TAG}
          docker push m1k1o/neko:${DOCKER_TAG}
        env:
          DOCKER_TAG: google-chrome

      - name: Build ungoogled-chromium
        run: |
          .m1k1o/build ${DOCKER_TAG}
          docker push m1k1o/neko:${DOCKER_TAG}
        env:
          DOCKER_TAG: ungoogled-chromium

      - name: Build tor-browser
        run: |
          .m1k1o/build ${DOCKER_TAG}
          docker push m1k1o/neko:${DOCKER_TAG}
        env:
          DOCKER_TAG: tor-browser

      - name: Build vncviewer
        run: |
          .m1k1o/build ${DOCKER_TAG}
          docker push m1k1o/neko:${DOCKER_TAG}
        env:
          DOCKER_TAG: vncviewer

      - name: Build vlc
        run: |
          .m1k1o/build ${DOCKER_TAG}
          docker push m1k1o/neko:${DOCKER_TAG}
        env:
          DOCKER_TAG: vlc

      - name: Build xfce
        run: |
          .m1k1o/build ${DOCKER_TAG}
          docker push m1k1o/neko:${DOCKER_TAG}
        env:
          DOCKER_TAG: xfce

And it also does not run in parallel, what would be also good.

@mbattista
Copy link
Contributor

mbattista commented Jun 13, 2021

You are right, I changed my example to show parallel builds.

My suggestion for the main project:
P.S. this suggestions loses the latest tag. This has either to be done in an extra step or with an if [ ${DOCKER_TAG} == "firefox" ] in the run

name: "CI for builds"

on:
  push:
    branches: [ dev ]

jobs:
  build_base:
    runs-on: ubuntu-latest
    #
    # do not run on forks
    #
    if: github.repository_owner == 'm1k1o'
    steps:
      - name: Check Out Repo
        uses: actions/checkout@v2

      - name: Login to Docker Hub
        run: |
          docker login --username ${DOCKERHUB_USERNAME} --password-stdin <<< "${DOCKERHUB_TOKEN}"
        env:
          DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
          DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}

      - name: Build base
        run: |
          .m1k1o/build ${DOCKER_TAG}
          docker push m1k1o/neko:${DOCKER_TAG}
        env:
          DOCKER_TAG: base

  build_container:
    runs-on: ubuntu-latest
    if: github.repository_owner == 'm1k1o'
    needs: [build_base]
    strategy:
      matrix:
        #
        # hardcoded :( but I do not see any other way
        #
        tags: [firefox, chromium, google-chrome, ungoogled-chromium, tor-browser, vncviewer, vlc, xfce]
    steps:
      - name: Check Out Repo
        uses: actions/checkout@v2

      - name: Login to Docker Hub
        run: |
          docker login --username ${DOCKERHUB_USERNAME} --password-stdin <<< "${DOCKERHUB_TOKEN}"
        env:
          DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
          DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}

      - name: Build container
        run: |
          .m1k1o/build ${DOCKER_TAG}
          docker push m1k1o/neko:${DOCKER_TAG}
        env:
          DOCKER_TAG: ${{ matrix.tags }}

@m1k1o
Copy link
Owner Author

m1k1o commented Jun 13, 2021

That looks way more cleaner, thanks for your suggestion.

About do not run on forks option. Maybe we could store the image name & docker repository inside secrets and run this action only if those values exists. So that anyone who forked this reopsitory can easily enable own actions.

Having these secrets:

DOCKER_IMAGE="m1k1o/neko"
DOCKER_REGISTRY="docker.io"
DOCKER_USERNAME
DOCKER_TOKEN

Having contition like this (not sure if that would work):

if: secrets.DOCKER_IMAGE && secrets.DOCKER_USERNAME && secrets.DOCKER_TOKEN

And replaced login action with this:

      - name: Login to Docker Hub
        run: |
          docker login --username "${DOCKER_USERNAME}" --password-stdin "${DOCKER_REGISTRY}" <<< "${DOCKER_TOKEN}"
        env:
          DOCKER_REGISTRY: ${{ secrets.DOCKER_REGISTRY }}
          DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
          DOCKER_TOKEN: ${{ secrets.DOCKER_TOKEN }}

While modifying build script that takes image as environment variable:

      - name: Build container
        run: |
          BUILD_IMAGE=${DOCKER_IMAGE} .m1k1o/build ${DOCKER_TAG}
          docker push ${DOCKER_IMAGE}:${DOCKER_TAG}
        env:
          DOCKER_TAG: ${{ matrix.tags }}
          DOCKER_IMAGE: ${{ secrets.DOCKER_IMAGE }}

That should give any fork the freedom to push own images by just modifying secrets accordingly.

And as for the forks, they can disable actions in the settings or just choose own to be run.

image

Edit: Not possible. :( actions/runner#520

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants