Giter Club home page Giter Club logo

aio-apps-action's Introduction

Build Status License

aio-apps-action

Adobe Developer App Builder support for GitHub actions. This action leverages AIO CLI to build, test and deploy App Builder applications.

Getting Started

This Github action supports following commands

  1. build - Builds App Builder application. This is similar to using aio app build command using AIO CLI

  2. test - Test App Builder application. This is similar to using aio app test command using AIO CLI

  3. deploy - Deploys App Builder application. This is similar to running aio app deploy --skip-build command using AIO CLI. Deploy Command also supports --no-publish and --force-deploy flag for aio app deploy command to control publishing of Extensions. See usage section for more details.

  4. auth - (Deprecated) Generates JWT based IMS Token and adds that to Github Action Environment for AIO CLI to use. The token is required to build and deploy App Builder Extensions.

    • JWT credential used in this step must have scopes attached that allow interaction with the Extension Registry API and Developer Console API. This can be achieved by adding the I/O Management API to the credential in the Developer Console. The appropriate scopes will then be automatically requested and attached to the token generated during this step.
    • (Optional) If the credential already has scopes attached that allow access to the Extension Registry API and Developer Console API, see the optional auth step below for how to configure the custom SCOPES variable to request a specific set of scopes.
  5. oauth_sts - Generates OAuth Server-To-Server based IMS Token and adds that to Github Action Environment for AIO CLI to use. The token is required to build and deploy App Builder Extensions.

    • OAuth Credential used in this step must have scopes attached that allow interaction with the Extension Registry API and Developer Console API. This can be achieved by adding the I/O Management API to the credential in the Developer Console. The appropriate scopes will then be automatically requested and attached to the token generated during this step.
    • (Optional) If the credential already has scopes attached that allow access to the Extension Registry API and Developer Console API, see the optional oauth_sts step below for how to configure the custom SCOPES variable to request a specific set of scopes.

Prerequisites for Commands

  1. build

    • Standalone App
      1. AIO_RUNTIME_NAMESPACE - namespace to be used for the App
    • Extensions
      1. AIO_RUNTIME_NAMESPACE - namespace to be used for the App
      2. AUTH command should have been executed prior to build to make sure required token is available
  2. test - None

  3. deploy

    • Standalone App
      1. AIO_RUNTIME_NAMESPACE - namespace to be used for the App
      2. AIO_RUNTIME_AUTH - auth for above namespace
    • Extensions
      1. AIO_RUNTIME_NAMESPACE - namespace to be used for the App
      2. AIO_RUNTIME_AUTH - auth for above namespace
      3. AIO_PROJECT_ID - Adobe I/O Console project ID
      4. AIO_PROJECT_NAME - Adobe I/O Console project name
      5. AIO_PROJECT_ORG_ID - AMS Org id (e.g. '53444')
      6. AIO_PROJECT_WORKSPACE_ID - Workspace Id
      7. AIO_PROJECT_WORKSPACE_NAME - Workspace name
      8. AIO_PROJECT_WORKSPACE_DETAILS_SERVICES - list of services added to above workspace in following format (ex. '[{"code": "AdobeIOManagementAPISDK", "name": "I/O Management API"}]' )
      9. AUTH command should have been executed prior to build to make sure required token is available in case extensions are to be published. Else use noPublish command flag to disbale app publish
  4. auth

    • Standalone App auth command is not required for standalone Apps
    • Extensions
      1. CLIENTID - Client id for the Adobe I/O console project
      2. CLIENTSECRET - Client secret for the Adobe I/O console project
      3. TECHNICALACCOUNTID - Technical account Id for the Adobe I/O console project
      4. IMSORGID - IMS Org Id
      5. KEY - Private key associated with project
      6. (optional) SCOPES - List of meta scopes to request for JWT token
        • Example: ["meta_scope1", "meta_scope2"]
  5. oauth_sts

    1. CLIENTID - Client id of Adobe I/O console project
    2. CLIENTSECRET - Comma separated String of Client secrets of Adobe I/O console project
    3. TECHNICALACCOUNTID - Technical account Id of Adobe I/O console project
    4. TECHNICALACCOUNTEMAIL - Technical account email of Adobe I/O console project
    5. IMSORGID - IMS Org Id
    6. (optional) SCOPES - comma-separated list of scopes for OAuth Server-To-Server Credentials
      • Example: AdobeID, openid, read_organizations

Command Usage and required params

You can include the action in your workflow as adobe/aio-apps-action@ Example :

For Standalone App

name: AIO App CI

on:
  release:
    types: [released]
jobs:
  deploy:
    name: Deploy to Prod
    runs-on: ${{ matrix.os }}
    strategy:
      max-parallel: 1
      matrix:
        node-version: ['20']
        os: [ubuntu-latest]
    steps:
      - name: Checkout
        uses: actions/checkout@v4
      - name: Use Node.js ${{ matrix.node-version }}
        uses: actions/setup-node@v4
        with:
          node-version: ${{ matrix.node-version }}
      - name: npm install
        run: npm i
      - name: Setup CLI
        uses: adobe/[email protected]
        with:
          os: ${{ matrix.os }}
          version: 10.x.x
      - name: Build
        env:
          AIO_RUNTIME_NAMESPACE: ${{ secrets.AIO_RUNTIME_NAMESPACE_PROD }}
        uses: adobe/[email protected]
        with:
          os: ${{ matrix.os }}
          command: build
      - name: Deploy
        env:
          AIO_RUNTIME_NAMESPACE: ${{ secrets.AIO_RUNTIME_NAMESPACE_PROD }}
          AIO_RUNTIME_AUTH: ${{ secrets.AIO_RUNTIME_AUTH_PROD }}
        uses: adobe/[email protected]
        with:
          os: ${{ matrix.os }}
          command: deploy

For Extensions - JWT based (Deprecated)

Set noPublish flag for Deploy command to true/false to control publishing of Extensions. Set forceDeploy flag to true to force deploy the Extension.
name: AIO App CI

on:
  release:
    types: [released]
jobs:
  deploy:
    name: Deploy to Prod
    runs-on: ${{ matrix.os }}
    strategy:
      max-parallel: 1
      matrix:
        node-version: ['20']
        os: [ubuntu-latest]
    steps:
      - name: Checkout
        uses: actions/checkout@v4
      - name: Use Node.js ${{ matrix.node-version }}
        uses: actions/setup-node@v4
        with:
          node-version: ${{ matrix.node-version }}
      - name: npm install
        run: npm i
      - name: Setup CLI
        uses: adobe/[email protected]
        with:
          os: ${{ matrix.os }}
          version: 10.x.x
      - name: Auth
        uses: adobe/[email protected]
        with:
          os: ${{ matrix.os }}
          command: auth
          CLIENTID: ${{ secrets.CLIENTID_PROD }}
          CLIENTSECRET: ${{ secrets.CLIENTSECRET_PROD }}
          TECHNICALACCOUNTID: ${{ secrets.TECHNICALACCID_PROD }}
          IMSORGID: ${{ secrets.IMSORGID_PROD }}
          KEY: ${{ secrets.KEY_PROD }}
      - name: Build
        env:
          AIO_RUNTIME_NAMESPACE: ${{ secrets.AIO_RUNTIME_NAMESPACE_PROD }}
        uses: adobe/[email protected]
        with:
          os: ${{ matrix.os }}
          command: build
      - name: Deploy
        env:
          AIO_RUNTIME_NAMESPACE: ${{ secrets.AIO_RUNTIME_NAMESPACE_PROD }}
          AIO_RUNTIME_AUTH: ${{ secrets.AIO_RUNTIME_AUTH_PROD }}
          AIO_PROJECT_ID: ${{ secrets.AIO_PROJECT_ID_PROD }}
          AIO_PROJECT_NAME: ${{ secrets.AIO_PROJECT_NAME_PROD }}
          AIO_PROJECT_ORG_ID: ${{ secrets.AIO_PROJECT_ORG_ID_PROD }}
          AIO_PROJECT_WORKSPACE_ID: ${{ secrets.AIO_PROJECT_WORKSPACE_ID_PROD }}
          AIO_PROJECT_WORKSPACE_NAME: ${{ secrets.AIO_PROJECT_WORKSPACE_NAME_PROD }}
          AIO_PROJECT_WORKSPACE_DETAILS_SERVICES: ${{ secrets.AIO_PROJECT_WORKSPACE_DETAILS_SERVICES_PROD }}
        uses: adobe/[email protected]
        with:
          os: ${{ matrix.os }}
          command: deploy
          noPublish: false

For Extensions OAuth Server-To-Server based

Set noPublish flag for Deploy command to true/false to control publishing of Extensions. Set forceDeploy flag to true to force deploy the Extension.
name: AIO App CI

on:
  release:
    types: [released]
jobs:
  deploy:
    name: Deploy to Prod
    runs-on: ${{ matrix.os }}
    strategy:
      max-parallel: 1
      matrix:
        node-version: ['20']
        os: [ubuntu-latest]
    steps:
      - name: Checkout
        uses: actions/checkout@v4
      - name: Use Node.js ${{ matrix.node-version }}
        uses: actions/setup-node@v4
        with:
          node-version: ${{ matrix.node-version }}
      - name: npm install
        run: npm i
      - name: Setup CLI
        uses: adobe/[email protected]
        with:
          os: ${{ matrix.os }}
          version: 10.x.x
      - name: Auth
        uses: adobe/[email protected]
        with:
          os: ${{ matrix.os }}
          command: oauth_sts
          CLIENTID: ${{ secrets.CLIENTID_PROD }}
          CLIENTSECRET: ${{ secrets.CLIENTSECRET_PROD }}
          TECHNICALACCOUNTID: ${{ secrets.TECHNICALACCID_PROD }}
          TECHNICALACCOUNTEMAIL: ${{ secrets.TECHNICALACCEMAIL_PROD }}
          IMSORGID: ${{ secrets.IMSORGID_PROD }}
          SCOPES: ${{ secrets.SCOPES_PROD }}
      - name: Build
        env:
          AIO_RUNTIME_NAMESPACE: ${{ secrets.AIO_RUNTIME_NAMESPACE_PROD }}
        uses: adobe/[email protected]
        with:
          os: ${{ matrix.os }}
          command: build
      - name: Deploy
        env:
          AIO_RUNTIME_NAMESPACE: ${{ secrets.AIO_RUNTIME_NAMESPACE_PROD }}
          AIO_RUNTIME_AUTH: ${{ secrets.AIO_RUNTIME_AUTH_PROD }}
          AIO_PROJECT_ID: ${{ secrets.AIO_PROJECT_ID_PROD }}
          AIO_PROJECT_NAME: ${{ secrets.AIO_PROJECT_NAME_PROD }}
          AIO_PROJECT_ORG_ID: ${{ secrets.AIO_PROJECT_ORG_ID_PROD }}
          AIO_PROJECT_WORKSPACE_ID: ${{ secrets.AIO_PROJECT_WORKSPACE_ID_PROD }}
          AIO_PROJECT_WORKSPACE_NAME: ${{ secrets.AIO_PROJECT_WORKSPACE_NAME_PROD }}
          AIO_PROJECT_WORKSPACE_DETAILS_SERVICES: ${{ secrets.AIO_PROJECT_WORKSPACE_DETAILS_SERVICES_PROD }}
        uses: adobe/[email protected]
        with:
          os: ${{ matrix.os }}
          command: deploy
          noPublish: false

Contributing

Contributions are welcomed! Read the Contributing Guide for more information.

Licensing

This project is licensed under the Apache V2 License. See LICENSE for more information.

aio-apps-action's People

Contributors

amulyakashyap09 avatar dependabot[bot] avatar himavanth avatar meryllblanchet avatar michaelgoberling avatar pablomoreno61 avatar purplecabbage avatar sandeep-paliwal avatar shazron avatar yahor-mikheyenka-wttech avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

aio-apps-action's Issues

missing documentation for new Extension Registry functionality

  1. The auth command is not documented. Please also add text to say that this is used to generate an IMS token to publish to the extension registry. See https://github.com/adobe/generator-aio-app/blob/97619bfd0f7a5fe3c635f415043e7c4d2297a045/generators/add-ci/.github/workflows/deploy_stage.yml#L30-L40 (but with noPublish: true you won't need to have this command in your Github Actions workflow)
  2. The deploy command noPublish input is not documented. Please also add text to say that these extra parameters https://github.com/adobe/generator-aio-app/blob/97619bfd0f7a5fe3c635f415043e7c4d2297a045/generators/add-ci/.github/workflows/deploy_stage.yml#L52-L57 are needed for publishing to the Extension Registry (but with noPublish: true you won't need them)

Add support for OAuth credentials

When users deploy an extension using this action, they have to supply IMS Auth

Right now the action is only set up to support jwt credentials as it explicitly uses the private key and still uses the meta_scopes parameter when setting up the context in ims

We should add support for using OAuth credentials with this action since jwt has been deprecated

CI Auth Fails

Expected Behaviour

Workflows for test and deploy succeed

Actual Behaviour

Workflows for test and deploy fail on auth step.

https://github.com/hannessolo/test-aio-working-directory/actions/runs/4480318641/jobs/7875446748

Reproduce Scenario (including but not limited to)

  1. Create a new app: aio app init test-app --standalone-app
  2. Select only actions as the modules
  3. Check that the github workflow files were added
  4. Push the code to a new repository on github
  5. Add secrets as documented here https://developer.adobe.com/app-builder/docs/guides/deployment/ci_cd_for_firefly_apps/#github-secrets
  6. Re-run the workflow if needed
  7. See that it failed https://github.com/hannessolo/test-aio-working-directory/actions/runs/4480318641/jobs/7875446748

Logs taken while reproducing problem

https://github.com/hannessolo/test-aio-working-directory/actions/runs/4480318641/jobs/7875446748

Why use os matrix?

Expected Behaviour

Code is executed once on ubuntu-latest.

Actual Behaviour

os matrix is used, implying that other os' could be added, which will cause the code to run more than once.
The actual action code checks if it is running in ubuntu and will 'do less' if it is not, but it should just not happen.

Error: The `set-env` command is deprecated and will be disabled soon

When running the current GH workflow to deploy an app, there's warning

Error: The `set-env` command is deprecated and will be disabled soon. Please upgrade to using Environment Files. For more information see: https://github.blog/changelog/2020-10-01-github-actions-deprecating-set-env-and-add-path-commands/

see https://github.com/icaraps/test-firefy-gh-workflow/runs/1357966726#step:6:8

It might come from an underlaying dependency https://github.com/actions/toolkit/search?q=set-env.

Error running action on windows os

Expected Behaviour

Test PR on windows os.

Actual Behaviour

I get the error below:

  • [email protected]
    added 511 packages from 350 contributors in 38.737s
    C:\windows\system32\cmd.exe /D /S /C "C:\npm\prefix\aio.cmd app test"
    child_process.js:127
    p.open(fd);
    ^

Error: EBADF: bad file descriptor, uv_pipe_open
at Object._forkChild (child_process.js:127:5)
at setupChildProcessIpcChannel (internal/bootstrap/pre_execution.js:334:30)
at prepareMainThreadExecution (internal/bootstrap/pre_execution.js:57:3)
at internal/main/run_main_module.js:7:1 {
errno: -4083,
code: 'EBADF',
syscall: 'uv_pipe_open'
}
» Error: Command failed with ENOENT: jest --passWithNoTests ./test
» spawn jest ENOENT
Error: The process 'C:\npm\prefix\aio.cmd' failed with exit code 2

Reproduce Scenario (including but not limited to)

Steps to Reproduce

Trigger GitHub action on Windows os

Platform and Version

Sample Code that illustrates the problem

Logs taken while reproducing problem

Rename aio-apps-action repo

It is unclear that this is a CI action, or a Github action, and NOT a runtime action.
Suggestions: aio-apps-gh-action, aio-apps-ci-cd, aio-apps-devops, ..?

Standalone app deploy fails imsOrgId must be defined

Expected Behaviour

App gets deployed with CI CD.

Actual Behaviour

Deployment fails with error "imsOrgId must be defined"

Reproduce Scenario (including but not limited to)

  1. Create a standalone app using aio CLI that has action only

Steps to Reproduce

  1. Create a standalone app with action only
  2. Make sure github workflow yml is configured as per documentation
  3. Deploy using github CI CD

Platform and Version

Sample Code that illustrates the problem

Attached screenshots of code structure and how deployment yml looks like.

Logs taken while reproducing problem

Screenshot 2023-05-09 at 2 47 39 pm
Screenshot 2023-05-09 at 2 47 25 pm

Improve scope environment variable handling

Right now, using the SCOPE environment variable is not intuitive. When requesting one scope, users can submit a single value. However, when requesting multiple scopes, users have to create a secret in their repository where the scopes they'd like to request are enclosed in brackets and double-quoted:

GitHub Secret

["scope1", "scope2"]

Not only should this be documented, but users should be able to create their SCOPE secret with a variety of syntaxes. The following are all reasonable:

  • scope1,scope2
  • 'scope1','scope2'
  • ['scope1','scope2']

Test workflow fails on a new Firefly App

Steps to Reproduce

  1. Create a Firefly Project aio app init and check options: actions, web assets and CI/CD.
  2. Push your project on Github
  3. Edit README.md and open a PR

The PR checks will fail because of

Screen Shot 2020-05-12 at 3 28 46 PM

Also I noticed that the E2E tests won't run by default. What do you recommend if devs want to include E2E tests into the pipeline ?

App Deploy fails because of token validation

Expected Behaviour

Actual Behaviour

With new extension support app deploy needs token to update endpoints. Although token is set by GH action auth command but CI/CD workflow to deploy aio app fails with token validation (as no token expiry info is available in CI env)

Reproduce Scenario (including but not limited to)

Steps to Reproduce

Platform and Version

Sample Code that illustrates the problem

Logs taken while reproducing problem

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.