Woodpecker config guide

Note that to force a pull of the image during run, it needs pull: true

Setting variables based on step output

Persisting environment data

  steps:
  - name: init
    pull: true
    image: docker.domain.tld/custom-image
    commands:
      - echo "FOO=hello" >> envvars
      - echo "BAR=world" >> envvars

  - name: debug
    image: bash
    commands:
      - source envvars
      - echo $FOO
  

Injecting variables via API

Here’s the relevant API

  POST https://domain.tld/api/repos/{repo_id}/pipelines
{
  "branch": "master",
  "variables": {
      "hello": "world"
  }
}
  

In the build, it should have in its environment the variable hello

Troubleshooting

Create organization

Github Discussion I had an annoying issue with organizations. There didn’t seem to be a way to create one. To fix this, I went into the database and ran this

  select * from orgs;
  

Result:

  select * from orgs;
id|forge_id|name|is_user|private
1|0|user|1|0
2|0|myorg|1|0
  

I guess it didn’t detect it correctly? To fix, I just updated to not be a is_user..

  update orgs set is_user=0 where id=2;