Git Product home page Git Product logo

example-services's People

Contributors

arnaudrinquin avatar chrispat avatar dimakura avatar kaytwo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

example-services's Issues

Running services from the Github Package Registry

Hi,

Is there any example of running services from images published onto the GitHub Package Registry? Is this feature supported?

When trying to run a service based on an image hosted on docker.pkg.github.com, I get an authentication error in the job setup step:
Error response from daemon: Get https://docker.pkg.github.com/v2/org/repo/image/manifests/latest: no basic auth credentials

Worth noting, the repository containing the package is public.

Thank you!

container-job/vm-job failed to run with exit code 126

By using this example: https://github.com/actions/example-services/blob/master/.github/workflows/postgres-service.yml
(not changing anything) getting the error

##[error]Process completed with exit code 126.
Run npm ci
OCI runtime exec failed: exec failed: container_linux.go:345: starting container process caused "chdir to cwd ("/__w/buildsqlx/buildsqlx/./postgres") set in config.json failed: no such file or directory": unknown
##[error]Process completed with exit code 126.

Confused about the goal of these examples

I'm still in the early phases of ramping up on github actions, so forgive me if I'm just missing something. I just took a look at redis-service.yml, and it seems like the workflow is doing the same thing twice. Once in a container, and once in a virtual machine. Is this the point of the example? Wouldn't it be more useful for the vm-job to connect to the existing redis set up in the container? Is that even possible?

Provide native seeding capability for actions

I had already asked support and they said native seeding isn't available and to check the actions forum. I posted this question (https://github.community/t5/GitHub-Actions/Support-for-seeding-database/m-p/53702#M8933) and it was suggested I create an issue for this here.

In many pipelines it can be beneficial to run a small set of database tests. Docker provides the ability to natively seed a database like so:

psql:
    image: "postgres"
    volumes:
      - ./seed.sql:/docker-entrypoint-initdb.d/init.sql

Would it be possible to have some kind of native action for this? Or if not, an acceptable workaround documented? I did check the docs some time ago but couldn't find any information on seeding. But I may have missed that

Thanks 😄

Error: Process completed with exit code 6.

When I add a new post on my blog, I got an error during the build.

image

But when I check my status using "bundle install". I don't know what is wrong....

bundle install
Using public_suffix 4.0.6
Using addressable 2.7.0
Using bundler 2.1.4
Using colorator 1.1.0
Using concurrent-ruby 1.1.7
Using eventmachine 1.2.7
Using http_parser.rb 0.6.0
Using em-websocket 0.5.2
Using ffi 1.13.1
Using ethon 0.12.0
Using forwardable-extended 2.6.0
Using mercenary 0.4.0
Using mini_portile2 2.4.0
Using nokogiri 1.10.10
Using nokogumbo 2.0.4
Using parallel 1.20.1
Using rainbow 3.0.0
Using typhoeus 1.4.0
Using yell 2.2.2
Using html-proofer 3.17.4
Using i18n 1.8.5
Using sassc 2.4.0
Using jekyll-sass-converter 2.1.0
Using rb-fsevent 0.10.4
Using rb-inotify 0.10.1
Using listen 3.3.3
Using jekyll-watch 2.2.1
Using rexml 3.2.4
Using kramdown 2.3.0
Using kramdown-parser-gfm 1.1.0
Using liquid 4.0.3
Using pathutil 0.16.2
Using rouge 3.26.0
Using safe_yaml 1.0.5
Using unicode-display_width 1.7.0
Using terminal-table 1.8.0
Using jekyll 4.1.1
Using jekyll-paginate 1.1.0
Using jekyll-redirect-from 0.16.0
Using jekyll-seo-tag 2.6.1
Bundle complete! 5 Gemfile dependencies, 40 gems now installed.
Bundled gems are installed into ./vendor/bundle

Does anyone help me?

Rename default branch

👋 This issue is to track the move over to using main as the default branch for this repo. We’d love your team's help in completing this transition.

Do not remove your old default branch, customers are going to be using it. We will be sending messages out about these changes, but if you want to message in your repository, that's fine as well.

  • Create a main branch.
  • You might need to rebase any pull requests you want to merge before changing the default branch.
  • Change the default branch in settings to main.
  • Update any documentation in this repo to refer to the new branch name, although using the version tag is still preferred.
  • Check that this Action works correctly for users who have a repository with a custom default branch name.
  • Close this issue and celebrate 🎉

We are aiming to complete this work by August 28th.

The postgres example does not work out of the box.

Got this error:
ERRO[0003] Unable to interpolate string '${{ job.services.postgres.ports[5432] }}' - [TypeError: Cannot access member 'ports' of undefined]
[Postgres Service Example/vm-job ] ⭐ Run node client.js
| (node:32) UnhandledPromiseRejectionWarning: Error: connect ECONNREFUSED 127.0.0.1:5432
| at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1137:16)
| (node:32) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
| (node:32) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
| /github/workspace/postgres/client.js:14
| if (err) throw err
| ^
|
| Error: Connection terminated unexpectedly

Actions and services feedback (health check questions)

Hi @chrispat and @mscoutermarsh 👋

As you have been active on this repo, I assume you have some insight in the services side of GitHub Actions. I hope you don't mind receiving some feedback here. I thought it would be quicker to reach the right people than going via [email protected].

I'm thankful for the postgres example as it brought up a few things that aren't in the docs (yet?): ports get randomly assigned (this is mentioned but I think I overlooked it as ${{ job.services.redis.ports['6379'] }} wasn't used in the YAML snippet) and that health checks are needed.

About the health checks, my tests need Memcached and RabbitMQ, and I've been successful in starting memcached, but not RabbitMQ.

Here's the services definition of my job:

    services:
      memcached:
        image: memcached:latest
        ports:
        - 11211/udp
        # needed because the memcached container does not provide a healthcheck
        options: --health-cmd "timeout 5 bash -c 'cat < /dev/null > /dev/udp/127.0.0.1/11211'" --health-interval 10s --health-timeout 5s --health-retries 5
      rabbitmq:
        image: rabbitmq:latest
        ports:
        - 5672/tcp
        # needed because the rabbitmq container does not provide a healthcheck
        options: --health-cmd "rabbitmqctl node_health_check" --health-interval 10s --health-timeout 5s --health-retries 5

It looks like the container needs to report healthy in ~30 seconds (the other time I ran this it said "waiting 32 seconds ..."):

starting
rabbitmq service is starting, waiting 29 seconds before checking again.
/usr/bin/docker inspect --format="{{if .Config.Healthcheck}}{{print .State.Health.Status}}{{end}}" 9d446afa3d021ab0c08c48fd699119a452a109783c1c2032862cc813562b7474
unhealthy
##[error]Failed to initialize, rabbitmq service is unhealthy.

I'm not sure why it isn't reporting healthy, it works locally for me, in less than 30 seconds. Maybe my computer is faster than GitHub's? :-)

Is it possible for GitHub Actions to give me more info on what's happening? Like docker inspect --format='{{json .State.Health}}'

Contributing Example for WebDriver Selenium

I would make the PR, but I am not well versed in JS.

For .github/workflows/selenium-service.yml

name: CI

on:
    push:
        branches:
            - master
    pull_request:
        branches:
            - master
    release:
        types:
            - created

jobs:
    container-job:
        runs-on: ubuntu-latest
      
        # runs all of the steps inside the specified container rather than on the VM host.  
        # Because of this the network configuration changes from host based network to a container network.
        container:
            image: node:current

        services:
            selenium:
                image: selenium/standalone-chrome
                # needed because the selenium container does not provide a healthcheck
                options: --health-cmd '/opt/bin/check-grid.sh'
      
        steps:
            - uses: actions/checkout@v1
            - run: npm ci
                working-directory: ./selenium
            - run: node client.js
                working-directory: ./selenium
                # use selenium for the host here because we have specified a container for the job.
                # If we were running the job on the VM this would be localhost
                SELENIUM_HOST: selenium
                # The default port will be the one used when we have specified a container for the job.
                SELENIUM_PORT: 4444
  
    # Runs all steps on the VM
    # The service containers will use host port binding instead of container networking so you access them via localhost rather than the service name
    vm-job:
        runs-on: ubuntu-latest
      
        services:
            selenium:
                image: selenium/standalone-chrome
                ports:
                    # will assign a random free host port
                    - 4444/tcp
                    # needed because the selenium container does not provide a healthcheck
                options: --health-cmd '/opt/bin/check-grid.sh'
        
        steps:
            - uses: actions/checkout@v1
            - run: npm ci
            working-directory: ./selenium
            - run: node client.js
            working-directory: ./selenium
            env:
                # use localhost for the host here because we are running the job on the VM.
                # If we were running the job on in a container this would be selenium
                SELENIUM_HOST: localhost
                SELENIUM_PORT: ${{ job.services.selenium.ports[4444] }} # get randomly assigned published port

For the selenium/client.js,

Something like

response = HTTP.post("http://$SELENIUM_HOST:$SELENIUM_PORT/wd/hub",
                     [("Content-Type" => "application/json")],
                     "{\"desiredCapabilities\":{\"browserName\":\"chrome\"}}")

dial tcp 127.0.0.1:5432: connect: connection refused

Hello, everything worked fine until recently without any changes in configuration files:

name: Postgres Service Example

on:
  push:
    branches:
      - master
      - db_postgres_setup
  pull_request:
    branches:
      - master

jobs:
  container-job:
    runs-on: ubuntu-latest

    # runs all of the steps inside the specified continer rather than on the VM host.
    # Because of this the network configuration changes from host based network to a container network.
    container:
      image:  node:10.16-jessie
    services:
      postgres:
        image: postgres:10.8
        env:
          POSTGRES_HOST: postgres
          POSTGRES_USER: postgres
          POSTGRES_PASSWORD: postgres
          POSTGRES_DB: postgres
        ports:
          - 5432:5432
        # needed because the postgres container does not provide a healthcheck
        options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5

And the service that trying to connect from another container:

name: Build and run
on: [push]
jobs:

  build:
    name: Build
    runs-on: ubuntu-latest
    steps:

    - name: Set up Go 1.12
      uses: actions/setup-go@v1
      with:
        go-version: 1.12
      id: go

    - name: Setup PostgreSQL
      uses: Harmon758/[email protected]

    - name: Check out code into the Go module directory
      uses: actions/checkout@v1

    - name: Get dependencies
      run: |
        go get -v -t -d ./...
        if [ -f Gopkg.toml ]; then
            curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
            dep ensure
        fi

    - name: Build
      run: go build -v .
      
    - name: Test
      run: go test

    - name: Code coverage
      run: go test -coverprofile=coverage.out

    - name: Push coverage to codecov
      run: bash <(curl -s https://codecov.io/bash) -t 489df204-a660-49b8-8ddb-6637ae4c4216

An error message is:

    builder_test.go:53: 
        	Error Trace:	builder_test.go:53
        	Error:      	Received unexpected error:
##[error]        	            	dial tcp 127.0.0.1:5432: connect: connection refused

It was exactly the same no changes to the configs and to connection string, just starting to fail.

Example for mongodb?

MongoDB is widely used in personal projects and enterprise products, but there virtually no documentation or example of using it in GitHub-action.
The addition of a workflow involving MongoDB would be great.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.