Coder Social home page Coder Social logo

radix-github-actions's Introduction

GitHub Action for Radix CLI

This Action for Radix CLI to integrate with the Radix platform from a GitHub Action workflow.

Contribution

Want to contribute? Read our contributing guidelines

Outputs

result

The standard output from execution of the rx command.

Usage

This Action can be used to run any rx command. The run make some assumptions:

  • An environment variable with the APP_SERVICE_ACCOUNT_TOKEN is available to the app, and this token belongs to a user or service principal who has the appropriate privileges for the operations you want to execute in the Radix cluster. See our documentation for example on how to acquire such a token in a GitHub Actions workflow. The environment variable can be set on a single step or on the entire flow.

All the examples below pass the github-token argument to the Action. Passing this argument is optional. The caveat of not passing this argument is that it gets more likely that the workflow fails because the hourly GitHub API rate limit has been exhausted. The Action uses to GitHub API to determine the most recent version of the rx CLI.

Examples:

- name: Deploy on Radix
  uses: equinor/radix-github-actions@v1
  with:
    github-token: ${{ secrets.GITHUB_TOKEN }}
    args: >
      create job
      deploy
      -a application-name
      -e ${{ steps.getEnvironment.outputs.result }}
      -f

-f will ensure that the action step is followed, and won't continue until step is complete.

- name: Deploy on Radix
  uses: equinor/radix-github-actions@v1
  with:
    github-token: ${{ secrets.GITHUB_TOKEN }}
    args: >
      create job
      deploy
      --context playground
      -a application-name
      -e ${{ steps.getEnvironment.outputs.result }}
      -f

--from-config will read information such as application-name, branch mapping etc from your radixconfig.yaml

- name: Deploy on radix
  uses: equinor/radix-github-actions@v1
  with:
    github-token: ${{ secrets.GITHUB_TOKEN }}
    args: >
      create job
      deploy
      --from-config
      -e ${{ steps.getEnvironment.outputs.result }}
      -f

--context playground will communicate with playground cluster, if your application resides there.

- name: Set component environment secret
  uses: equinor/radix-github-actions@v1
  with:
    github-token: ${{ secrets.GITHUB_TOKEN }}
    args: >
      set environment-secret
      --from-config
      -e <your environment name>
      --component <your component name>
      -s <your secret name>
      -v '<your secret value>'
- name: Get environment from branch mapping in Radix config for repository
  id: getEnvironment
  uses: equinor/radix-github-actions@v1
  with:
    github-token: ${{ secrets.GITHUB_TOKEN }}
    args: >
      get-config branch-environment
      --from-config
      -b ${GITHUB_REF##*/}
- name: Print the environment
  run: echo "${{ steps.getEnvironment.outputs.result }}"

Release

Triger Step 1 - Create pull requets with new version workflow and set the semver option to the correct version (must be a valid semver with Major.Minor.Patch format). The GitHub Workflow modifies the Dockerfile with the updated RX_VERSION set to your semver and create a new pull-request for you to approve. You can also run this locally in the repository with gh workflow run ci-step1.yaml --repository github.com/equinor/radix-github-actions --field semver=1.X.X

  1. Release Radix-Cli 1.11.0
  2. Trigger Step 1 - Create pull requets with new version Action 1.11.0
    • Modifies Dockerfile with the new RX_VERSION.
    • Creates a new branch and a PR
  3. Testing: run a test-workflow with eg. equinor/radix-github-action@update-rx-version-1-x-x
  4. Manually Merge PR
  5. The workflow Step 2 - Tag commit with new version will parse RX_VERSION from the Dockerfile and create/update the relevant tags.

License

The Dockerfile and associated scripts and documentation in this project are released under the MIT License.

Security

This is how we handle security issues

radix-github-actions's People

Contributors

emirgens avatar github-actions[bot] avatar ingeknudsen avatar magnus-longva-bouvet avatar nilsgstrabo avatar richard87 avatar satr avatar yusijs avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

yusijs mhorvat-no

radix-github-actions's Issues

Replace peter-evans/create-pull-request action with actions/github-script

name: Pull Request Action
on:
  push:
    branches:
      - feature/*
      
jobs:
  create-pull-request:
    runs-on: ubuntu-latest
    steps:
      - name: Create Pull Request
        uses: actions/github-script@v6
        with:
          script: |
            const { repo, owner } = context.repo;
            const result = await github.rest.pulls.create({
              title: '[Example] Simple demo',
              owner,
              repo,
              head: '${{ github.ref_name }}',
              base: 'develop',
              body: [
                'This PR is auto-generated by',
                '[actions/github-script](https://github.com/actions/github-script).'
              ].join('\n')
            });
            github.rest.issues.addLabels({
              owner,
              repo,
              issue_number: result.data.number,
              labels: ['feature', 'automated pr']
            });

https://stackoverflow.com/questions/68057744/create-pull-request-with-github-action

Output not accessible via result

version: 1.8.0

Since 1.8.0, the output of the command can no longer be accessed from steps.<step-id>.outputs.result. This appears to be caused by the simplification of entrypoint.sh, which removed the step where output is piped to $GITHUB_OUTPUT.

`Github Actions` extension in `VS Code` gives warning on use of `args`

VS Code v1.84.2
GitHub Actions v0.26.2

The validation routines in the github actions extension shows error on args.
Not sure why, but it's anoying, so if there is something that can be done in the implmentation of the action to make it understand it's totally fine, it would be great :-)

image

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.