GithubHelp home page GithubHelp logo

Comments (6)

dstrickland67 avatar dstrickland67 commented on May 12, 2024 1

That works.

Thanks,
David

from stepci.

mishushakov avatar mishushakov commented on May 12, 2024

Thanks for bug report, I'll look into it in a minute

from stepci.

mishushakov avatar mishushakov commented on May 12, 2024

Ok, so the bug has something to do with templating

from stepci.

mishushakov avatar mishushakov commented on May 12, 2024

So, this example works:

version: "1.1"
name: Basic Auth
env:
  auth: aGVsbG86d29ybGQ=
tests:
  example:
    steps:
      - name: Basic Auth
        http:
          url: https://httpbin.org/basic-auth/hello/world
          method: GET
          headers:
            Authorization: Basic {{env.auth}}
          check:
            status: 200

This should work fine too:

headers:
  Authorization: Bearer {{secrets.token}}

from stepci.

mishushakov avatar mishushakov commented on May 12, 2024

I have investigated the issue
turns out, YAML does some quirks when {{ }} is not in a string

entering

{{test}}

produces:

{
  "{\"test\"=>nil}": null
}

Try yourself: https://www.json2yaml.com

To fix the issue you have to wrap it in quotes, like that:

version: "1.1"
name: Basic Auth
env:
  username: hello
  password: world
tests:
  example:
    steps:
      - name: Basic Auth
        http:
          url: https://httpbin.org/basic-auth/hello/world
          method: GET
          auth:
            basic:
              username: "{{ env.username }}"
              password: "{{ env.password }}"
          check:
            status: 200

As this is a bit counterintuitive, I'll change the templating syntax to use ${{ }} instead (like GitHub Actions)
I'll close the issue, as this is not a bug with Step CI per se

Thanks a lot for reporting though 🙏

from stepci.

mishushakov avatar mishushakov commented on May 12, 2024

Update: I have changed the templating syntax, you now have to use ${{ }} for templates

from stepci.

Related Issues (20)

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.