hvalle / drone-gcs-cache

Drone plugin that allows caching on Google Cloud Storage.
Apache License 2.0
2 stars 2 forks source link

Cache loading gives "No action specified" message #3

Open robertcsakany opened 5 years ago

robertcsakany commented 5 years ago

I've added the key file to organization:

drone orgsecret add xxxxxxx gcs_cache_json_key @gcloud.json

I have this drone file:

---
kind: pipeline
name: default

steps:
  - name: restore-cache
    image: homerovalle/drone-gcs-cache
    pull: true
    bucket: drone-agent-m2-cache
    secrets: [ GCS_CACHE_JSON_KEY ]
    restore: true

  - name: build-artifacts
    pull: default
    image: maven:3.6.2-jdk-8
    commands:
      - mvn -s .maven.xml --no-transfer-progress clean package
    environment:
      M2_HOME: /drone/.m2
      MAVEN_HOME: /drone/.m2
    secrets:
      - sonatype_username
      - sonatype_password
      - gpg_keyname
      - gpg_executable
      - gpg_passphrase
      - github_access_token
      - blackbelt_nexus_username
      - blackbelt_nexus_username
    when:
      event:
        - push
        - pull_request

  - name: rebuild-cache
    image: homerovalle/drone-gcs-cache
    pull: true
    bucket: drone-agent-m2-cache
    secrets: [ GCS_CACHE_JSON_KEY ]
    rebuild: true
    mount:
      - .m2
    when:
      event: push

  - name: flush_cache
    image: homerovalle/drone-gcs-cache
    pull: true
    bucket: drone-agent-m2-cache
    secrets: [ GCS_CACHE_JSON_KEY ]
    flush: true
    flush_age: 31

And I'm getting the following error:

1 time="2019-10-18T17:02:18Z" level=fatal msg="No action specified"

I've checked the code and seems the 'restore' is not defined.

Any idea?

KreativeKrise commented 5 years ago

Hi @robertcsakany ,

I'm also started to use the plugin. You have to use the Drone 1.0+ syntax to configure it. So this should work:

---
kind: pipeline
name: default

steps:
  - name: restore-cache
    image: homerovalle/drone-gcs-cache
    pull: always
    environment:
      GCS_CACHE_JSON_KEY:
        from_secret: your_google_service_account_json
    settings:
      bucket: drone-agent-m2-cache
      restore: true

  - name: build-artifacts
    pull: default
    image: maven:3.6.2-jdk-8
    commands:
      - mvn -s .maven.xml --no-transfer-progress clean package
    environment:
      M2_HOME: ${DRONE_WORKSPACE}/.m2
      MAVEN_HOME: ${DRONE_WORKSPACE}/.m2
    secrets:
      - sonatype_username
      - sonatype_password
      - gpg_keyname
      - gpg_executable
      - gpg_passphrase
      - github_access_token
      - blackbelt_nexus_username
      - blackbelt_nexus_username
    when:
      event:
        - push
        - pull_request

  - name: rebuild-cache
    image: homerovalle/drone-gcs-cache
    pull: always
    environment:
      GCS_CACHE_JSON_KEY:
        from_secret: your_google_service_account_json
    settings:
      bucket: drone-agent-m2-cache
      rebuild: true
      mount: .m2
    when:
      event: push

  - name: flush_cache
    image: homerovalle/drone-gcs-cache
    pull: always
    environment:
      GCS_CACHE_JSON_KEY:
        from_secret: your_google_service_account_json
    settings:
      bucket: drone-agent-m2-cache
      flush: true
      flush_age: 31

Good luck!