Search code examples
github-actionsoctopus-deploy

Unable to create release in Octopus Deploy using GitHub Actions


I am trying to set up GitHub Actions to create a release in Octopus deploy using the following steps:

- name: Install Octopus CLI 🐙
  uses: OctopusDeploy/[email protected]
  with:
    version: '*'

- name: Deploy 🐙
  run: |
    octopus release create --project ${{ env.OCTOPUS_PROJECT }} --channel ${{ env.OCTOPUS_CHANNEL}} --release-notes 'Release me' --package-version '1.0.675-feature-27ddcf53143'

I want to use the new octopus cli - https://octopus.com/docs/octopus-rest-api/cli/octopus-release-create.

These are the environment variables defined:

env:
  OCTOPUS_CHANNEL: 'Feature'
  OCTOPUS_URL: ${{ secrets.OCTOPUS_SERVER }}
  OCTOPUS_API_KEY: ${{ secrets.OCTOPUS_API_KEY }}
  OCTOPUS_SPACE: 'SPACE-NAME-HERE'
  OCTOPUS_PROJECT: 'PROJECT-NAME-HERE'

If I go to the Octopus UI and manually create a release, selecting channel 'Feature' and version '1.0.675-feature-27ddcf53143' of my packages, the release is created successfully.

However, when I try with the above code in GitHub Actions I get:

Octopus API error: The resource you requested was not found. [] Error: Process completed with exit code 1.

Running the following command works just fine:

octopus release list

For sake of completeness, here is the full github action workflow:

name: CI

on: [push, workflow_dispatch]

concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true

jobs:
  CI:
    runs-on: [self-hosted, linux, small]
    env:
      OCTOPUS_CHANNEL: 'Feature'
      OCTOPUS_URL: ${{ secrets.OCTOPUS_SERVER }}
      OCTOPUS_API_KEY: ${{ secrets.OCTOPUS_API_KEY }}
      OCTOPUS_SPACE: 'SPACE-NAME-HERE'
      OCTOPUS_PROJECT: 'PROJECT-NAME-HERE'
    steps:

    - name: Install Octopus CLI 🐙
      uses: OctopusDeploy/[email protected]
      with:
        version: '*'

    - name: Deploy 🐙
      run: |
        octopus release list --project ${{ env.OCTOPUS_PROJECT }}
        octopus release create --project ${{ env.OCTOPUS_PROJECT }} --channel ${{ env.OCTOPUS_CHANNEL }} --release-notes 'Release'

and the secrets:

EDIT - cant add picture of secrets as imgur is blocked my company. I verified that OCTOPUS_SERVER and OCTOPUS_API_KEY exists as secrets

What am I doing wrong? What is missing to make this work in GitHub Actions?


Solution

  • After working with Octopus support on this for some time, we reached the conclusion that the error is due to me using an older version of Octopus server (2019.11.1) together with the new octopus cli (in Go).

    Thank you to all of you for your assistance