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

[gha] pull_docker_image fails with latest master #610

Closed
fmessmer opened this issue Feb 4, 2021 · 13 comments
Closed

[gha] pull_docker_image fails with latest master #610

fmessmer opened this issue Feb 4, 2021 · 13 comments

Comments

@fmessmer
Copy link
Contributor

fmessmer commented Feb 4, 2021

we have been using our own docker image in github actions with our ici branch pinned to db261d7 (+ pylint feature from #477, i.e. https://github.com/fmessmer/industrial_ci/tree/master_pylint)

the config is (ref #574):

name: CI

on:
  push:
  pull_request:

jobs:
  industrial_ci:
    timeout-minutes: 60
    env:
      ADDITIONAL_DEBS: 'apt-utils curl dialog git-core openssh-client openssh-server wget'
      AFTER_INIT: mkdir -p ~/.ssh && touch ~/.ssh/known_hosts && ssh-keyscan github.com >> ~/.ssh/known_hosts && git config --global url."https://token:${{secrets.GITHUBPAT}}@github.com/".insteadOf "[email protected]:" && curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash && apt-get install git-lfs -y && cd $HOME && git lfs install && cd -
      BEFORE_PREPARE_DOCKER_IMAGE: echo ${{secrets.GITHUBPAT}} | docker login ghcr.io -u mojin-robotics-ci --password-stdin
      CATKIN_LINT: pedantic
      CATKIN_LINT_ARGS: '--ignore description_boilerplate --ignore target_name_collision'
      CMAKE_ARGS: -DCMAKE_BUILD_TYPE=Release
      NOT_TEST_DOWNSTREAM: true
      PYLINT_ARGS: "--output-format=parseable --errors-only"
      PYLINT2_CHECK: true  # pylint2 for kinetic, pylint3 for noetic
      PYLINT3_CHECK: false
      ROS_REPO: main
      SECRET_AVAILABLE: ${{secrets.GITHUBPAT}}
      VERBOSE_OUTPUT: false
      VERBOSE_TESTS: false
    strategy:
      matrix:
        env:
          - { ROS_DISTRO: kinetic,
              DOCKER_IMAGE: 'ghcr.io/mojin-robotics/mojin-ros:kinetic-full'
            }
          - { ROS_DISTRO: noetic,
              DOCKER_IMAGE: 'ghcr.io/mojin-robotics/mojin-ros:noetic-full'
            }
    name: ${{matrix.env.ROS_DISTRO}}
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
        with:
          lfs: true
      - name: Checkout LFS objects
        run: git lfs checkout
      - uses: 'fmessmer/industrial_ci@master_pylint'
        if: ${{ env.SECRET_AVAILABLE }} # prevents failure notifications if secret GITHUBPAT is not available
        env: ${{matrix.env}}

I rebased my fmessmer/industrial_ci@master_pylint branch to latest ros-industrial/industrial_ci@master branch to get the latest features, but with latest ros-industrial/industrial_ci@master we cannot pull our docker image anymore:

  Starting function 'pull_docker_image'
  Error response from daemon: Get https://ghcr.io/v2/mojin-robotics/mojin-ros/manifests/kinetic-full: unauthorized
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
Function 'pull_docker_image' returned with code '1' after 0 min 1 sec
Error: Process completed with exit code 1.

I quickly investigated what has changed since db261d7, but could not find an obvious solution

@mathias-luedtke
Copy link
Member

Did you try it with the regular master version?

@fmessmer
Copy link
Contributor Author

fmessmer commented Feb 4, 2021

yes, same thing!
so it's nothing related to our additional (pylint) commits - or a wrongly resolved merge conflict...

I'll try to iterate through the commit history trying to identify where things get broken...

@fmessmer
Copy link
Contributor Author

fmessmer commented Feb 4, 2021

as far as I can tell things get broken with the commits from "Commits on Jan 16, 2021" - see https://github.com/ros-industrial/industrial_ci/commits/master
everything up to "Commits on Jan 13, 2021" still works

trying to find the specific commit...

@mathias-luedtke
Copy link
Member

I think I just renamed "prepare_docker_image" to "pull_docker_image" step, so BEFORE_PREPARE_DOCKER_IMAGE has to be renamed.

@gavanderhoorn
Copy link
Member

@ipa-mdl: might be nice to provide some bw-compatibility by supporting the old env-var for a while?

@mathias-luedtke
Copy link
Member

@fmessmer: Apart from the rename, it might be better (and simpler) to run the login outside of industrial_ci.
@gavanderhoorn: it is not a single environment variable.. not sure how we can check it properly. The semantics of the hook changes slightly (thus the rename), so we cannot make it 100% backward compatible. However, we can show a warning and try to handle the compatibility..

@mathias-luedtke
Copy link
Member

However, we can show a warning and try to handle the compatibility..

Here we go: #611

@fmessmer: please test

@fmessmer
Copy link
Contributor Author

fmessmer commented Feb 4, 2021

thanks!
renaming BEFORE_PREPARE_DOCKER_IMAGEto BEFORE_PULL_DOCKER_IMAGE solves this issue

@fmessmer fmessmer closed this as completed Feb 4, 2021
@mathias-luedtke
Copy link
Member

@fmessmer: Your config contains some superfluous settings, you might want to clean this up. And I strongly recommend against calling ssh-keyscan in the script.

@fmessmer
Copy link
Contributor Author

fmessmer commented Feb 4, 2021

@fmessmer: Your config contains some superfluous settings, you might want to clean this up. And I strongly recommend against calling ssh-keyscan in the script.

could you point me to something specific, please?
I'd also be happy to hear an alternative to ssh-keyscan...
maybe you could post suggestions to #574 or #590

I'm just getting started with GithubAction and appreciate any guidance...😉

@mathias-luedtke
Copy link
Member

could you point me to something specific, please?

NOT_TEST_DOWNSTREAM and VERBOSE_* can be removed.
Not sure what you do with SECRET_AVAILABLE ^^

The docker login can be added as a step (no need for a hook script).
And I believe that the known_hosts fix is not needed, because you rewrite the URL to https.

@mathias-luedtke
Copy link
Member

And it seems that you are not using git lfs inside (?), so AFTER_INIT could be removed as well.

@fmessmer
Copy link
Contributor Author

to come back to this:
thanks for the feedback. indeed we could simplify things a lot 😉
just a comment on the SECRET_AVAILABLE magic: we use this trick to prevent gha builds on forks that do not have a secret.GITHUBPAT set up for their repository (because that would always fail). unfortunately, the if condition only works on env variables on not on secrets directly

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

3 participants