Skip to content

Conversation

spkane
Copy link

@spkane spkane commented Dec 30, 2020

Adding some more thorough examples since the documentation is sparse here and in the upstream library. I basically had to write a test application and read some various docs about the .env format to figure the logic out.

@ashwilliams1 ashwilliams1 marked this pull request as draft December 31, 2020 00:09
@spkane spkane marked this pull request as ready for review January 4, 2021 22:30
@spkane spkane marked this pull request as draft January 4, 2021 22:31
@spkane
Copy link
Author

spkane commented Jan 4, 2021

@ashwilliams1 Is there someone specific who can review this? I don't believe it needs any updating unless someone wants to simply ensure that it is correct.

@bradrydzewski
Copy link
Contributor

bradrydzewski commented Jan 4, 2021

we would probably want to document the env file format in a separate, dedicated page, and then link to that page from the quick start. The env file is used in multiple places (not just the drone exec) so having a separate reference document would be preferred. This also keeps are quick starts high level.

@spkane
Copy link
Author

spkane commented Jan 5, 2021

That makes sense. I'll leave you all to it then. I just hope that something gets merged in soon-ish, as this took some time to track down and needing to pass in something like an SSH key is a standard enough use case that this should help others avoid the difficulty of figuring this out themselves or just giving up.

@shyandsy
Copy link

for docker-build, the secret DOCKER_USERNAME and DOCKER_PASSWORD works well, docker image push successfully

but why I cant retrive these secret in test-secrets?

it should work, right?
base on the doc :https://docs.drone.io/secret/repository/

- name: test-secrets
  image: alpine:3.19
  environment:
    DOCKER_USERNAME:
      from_secret: DOCKER_USERNAME
    DOCKER_PASSWORD:
      from_secret: DOCKER_PASSWORD
  commands:
    - echo $USERNAME
    - echo "USERNAME => ${DOCKER_USERNAME}"
    - echo "PASSWORD length => ${#DOCKER_PASSWORD}"
    
- name: docker-build
  image: plugins/docker
  settings:
    dockerfile: Dockerfile
    repo: shyandsy/whoispua
    tags:
      - api_${DRONE_BRANCH//\//-}_${DRONE_COMMIT_SHA:0:7}
    username:
      from_secret: DOCKER_USERNAME
    password:
      from_secret: DOCKER_PASSWORD
    #push: false
  when:
    event:
      - push
      - tag

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

Successfully merging this pull request may close these issues.

3 participants