-
Notifications
You must be signed in to change notification settings - Fork 0
OPSEXP-3756 Move actions from alfresco-build-tools #19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 4 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
cf6f0cc
OPSEXP-3756 Move actions from alfresco-build-tools
pmacius 3e54d95
try with password
pmacius 028080b
also unpublish
pmacius e2b06e6
run always on main and on PRs where there are changes related to actions
pmacius 6a740b8
Update README.md
pmacius File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,121 @@ | ||
| name: 📦 Publish to Nuxeo Online Services | ||
| description: | | ||
| Publish package to Nuxeo Online service. | ||
| inputs: | ||
| package-path: | ||
| description: Path to the package file to be published. | ||
| required: true | ||
| nos-username: | ||
| description: Nuxeo Online Service username for authentication. | ||
| required: true | ||
| nos-token: | ||
| description: Nuxeo Online Service token for authentication. | ||
| required: true | ||
| nos-env: | ||
| description: | | ||
| Nuxeo Online Service target environment (production or staging). | ||
| unrecognized values fallback to 'staging'. | ||
| required: true | ||
| nos-org: | ||
| description: | | ||
| Nuxeo Online Service organization name. | ||
| default: nuxeo | ||
| skip-verify: | ||
| description: Skip verification of the published package. | ||
| default: "false" | ||
| outputs: | ||
| publishing-status: | ||
| description: Status of the publishing process. | ||
| value: ${{ steps.publish-output.outputs.status }} | ||
| package-url: | ||
| description: URL of the published package on Nuxeo Online Services. | ||
| value: ${{ steps.publish-output.outputs.url }} | ||
|
|
||
| runs: | ||
| using: "composite" | ||
| steps: | ||
| - name: Get Branch name | ||
| uses: Alfresco/alfresco-build-tools/.github/actions/get-branch-name@v14.0.0 | ||
|
|
||
| - name: Evaluate Target env if none has been set | ||
| shell: bash | ||
| run: | | ||
| case "${{ inputs.nos-env }}" in | ||
| "production") | ||
| CONNECT_HOST=connect.nuxeo.com | ||
| ;; | ||
| *) | ||
| CONNECT_HOST=nos-preprod-connect.nuxeocloud.com | ||
| ;; | ||
| esac | ||
| echo "CONNECT_BASE=https://${CONNECT_HOST}/nuxeo/site/marketplace" >> $GITHUB_ENV | ||
| echo "🎯 Target Nuxeo Online Services environment: '${CONNECT_HOST}'" | ||
|
|
||
| - name: Extract package info | ||
| shell: bash | ||
| env: | ||
| PACKAGE_XML: "package.xml" | ||
| run: | | ||
| unzip -t "${{ inputs.package-path }}" $PACKAGE_XML || { | ||
| echo "❌ The package file '${{ inputs.package-path }}' has no valid descriptor" | ||
| exit 1 | ||
| } | ||
| echo "📦 Extracting package information from ${{ inputs.package-path }}..." | ||
pmacius marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| for i in name version; do | ||
| VALUE=$(unzip -p "${{ inputs.package-path }}" $PACKAGE_XML | yq -p=xml ".package.+@${i}") | ||
| export "PACKAGE_${i^^}=${VALUE}" | ||
| echo "PACKAGE_${i^^}=${VALUE}" | tee -a $GITHUB_ENV | ||
| done | ||
| if [[ -z "${PACKAGE_NAME}" || -z "${PACKAGE_VERSION}" ]]; then | ||
| echo "❌ Unable to extract package name or version from descriptor" | ||
| exit 1 | ||
| fi | ||
|
|
||
| - name: Publish package to Nuxeo Online Services | ||
| shell: bash | ||
| id: publish | ||
| env: | ||
| NOS_USERNAME: ${{ inputs.nos-username }} | ||
| NOS_TOKEN: ${{ inputs.nos-token }} | ||
| run: | | ||
| PUBLISH=$(curl -sX POST \ | ||
| -u "${NOS_USERNAME}:${NOS_TOKEN}" \ | ||
| -w "%{http_code}" \ | ||
| -F "package=@${{ inputs.package-path }}" \ | ||
| "${CONNECT_BASE}/upload?batch=true&orgId=${{ inputs.nos-org }}") | ||
| echo "📢 Publishing package to Nuxeo Online Services..." | ||
pmacius marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| if [[ "${PUBLISH: -3}" != "200" ]]; then | ||
| echo "❌ Failed to publish package. HTTP Status: ${PUBLISH: -3}" | ||
| exit 1 | ||
| fi | ||
|
|
||
| - name: Verify published package on Nuxeo Online Services | ||
| id: verify | ||
| env: | ||
| NOS_USERNAME: ${{ inputs.nos-username }} | ||
| NOS_TOKEN: ${{ inputs.nos-token }} | ||
| shell: bash | ||
| if: inputs.skip-verify == 'false' | ||
| run: | | ||
| sleep 5 | ||
| echo "🔍 Verifying published package on Nuxeo Online Services..." | ||
| PUBLISHED=$(curl -sX GET \ | ||
| -u "${NOS_USERNAME}:${NOS_TOKEN}" \ | ||
| -w "%{http_code}" \ | ||
| "${CONNECT_BASE}/package/${PACKAGE_NAME}?version=${PACKAGE_VERSION}") | ||
| if [[ "${PUBLISHED: -3}" != "200" ]]; then | ||
| echo "❌ Published package verification failed. HTTP Status: ${PUBLISHED: -3}" | ||
| exit 1 | ||
| fi | ||
| echo "✅ Package '${PACKAGE_NAME}' version '${PACKAGE_VERSION}' successfully published to Nuxeo Online Services." | ||
|
|
||
| - name: Populate outputs | ||
| id: publish-output | ||
| shell: bash | ||
| if: always() | ||
| env: | ||
| PACKAGE_URL: ${{ format('{0}/package/{1}?version={2}', env.CONNECT_BASE, env.PACKAGE_NAME, env.PACKAGE_VERSION) }} | ||
| STATUS: ${{ inputs.skip-verify == 'false' && steps.verify.outcome || steps.publish.outcome }} | ||
| run: | | ||
| echo "url=${PACKAGE_URL}" >> $GITHUB_OUTPUT | ||
| echo "status=${STATUS}" >> $GITHUB_OUTPUT | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| <install /> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| <?xml version="1.0"?> | ||
| <package type="addon" name="ops-readiness-ci" version="0.1.0"> | ||
| <title>A dummy package to test OPS Readiness CI</title> | ||
| <description> | ||
| <div> | ||
| This is a dummy package created to test OPS Readiness CI. | ||
| </div> | ||
| </description> | ||
| <vendor>Hyland</vendor> | ||
| <target-platform> | ||
| <name>lts</name> | ||
| <version>[2023,)</version> | ||
| </target-platform> | ||
| <license>Apache 2.0</license> | ||
| <license-url>http://www.apache.org/licenses/LICENSE-2.0</license-url> | ||
| <visibility>PUBLIC</visibility> | ||
| </package> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| # Base image | ||
| ARG BASE_IMAGE_TAG="2023" | ||
| FROM docker-private.packages.nuxeo.com/nuxeo/nuxeo:${BASE_IMAGE_TAG} | ||
|
|
||
| # Build arguments | ||
| ARG BUILD_TAG=unknown | ||
| ARG SCM_REF=unknown | ||
| ARG VERSION=unknown | ||
| ARG BUILD_DATE="" | ||
| ARG PACKAGES_AUTH_USER | ||
| ARG PACKAGES_AUTH_TOKEN | ||
| ARG PACKAGES_LIST | ||
| ARG NUXEO_CONNECT_MODULES | ||
| ARG IMAGE_TITLE="Nuxeo Server" | ||
| ARG IMAGE_LICENSE="Apache 2.0" | ||
|
|
||
| # Labels | ||
| LABEL org.nuxeo.build-tag=$BUILD_TAG \ | ||
| org.nuxeo.scm-ref=$SCM_REF \ | ||
| org.nuxeo.version=$VERSION \ | ||
| org.label-schema.build-date="$BUILD_DATE" \ | ||
| org.label-schema.license="$IMAGE_LICENSE" \ | ||
| org.label-schema.name="$IMAGE_TITLE" \ | ||
| org.label-schema.vendor="$IMAGE_VENDOR" \ | ||
pmacius marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| org.opencontainers.image.created="$BUILD_DATE" \ | ||
| org.opencontainers.image.licenses="$IMAGE_LICENSE" \ | ||
| org.opencontainers.image.title="$IMAGE_TITLE" \ | ||
| org.opencontainers.image.vendor="Nuxeo" | ||
|
|
||
| # Switch to root | ||
| USER root | ||
|
|
||
| # Combined system dependencies and secure private repo installation into a single RUN to reduce image layers | ||
| # --- Install system dependencies and secure private repo --- | ||
| RUN --mount=type=secret,id=nuxeo-private,target=/tmp/nuxeo-private.repo <<EOC | ||
| dnf -y install gettext | ||
| envsubst </tmp/nuxeo-private.repo >/etc/yum.repos.d/nuxeo-private.repo | ||
| dnf -y install --skip-broken $PACKAGES_LIST | ||
| rm /etc/yum.repos.d/nuxeo-private.repo | ||
| dnf clean all | ||
| rm -rf /var/cache/dnf | ||
| EOC | ||
|
|
||
| USER nuxeo | ||
|
|
||
| RUN --mount=type=bind,from=modules,target=/modules \ | ||
| --mount=type=secret,id=NUXEO_CLID,env=NUXEO_CLID \ | ||
| --mount=type=secret,id=NUXEO_CONNECT_URL,env=NUXEO_CONNECT_URL <<EOC | ||
| if [ -n "${NUXEO_CONNECT_MODULES}" ]; then | ||
| OPT_CONNECT_URL="" | ||
| if [ -n "${NUXEO_CONNECT_URL}" ]; then | ||
| OPT_CONNECT_URL="--connect-url ${NUXEO_CONNECT_URL}" | ||
| fi | ||
| /install-packages.sh --clid ${NUXEO_CLID} "${OPT_CONNECT_URL}" ${NUXEO_CONNECT_MODULES} | ||
pmacius marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| else | ||
| echo "No Nuxeo Connect modules specified - skipping connect installation" | ||
| fi | ||
|
|
||
| mods=$(find /modules -maxdepth 1 -type f \( -name '*.zip' -o -name '*.jar' \) -print) | ||
| if [ -n "${mods}" ]; then | ||
| /install-packages.sh --offline ${mods} | ||
| else | ||
| echo "No offline package files (*.zip/*.jar) found in /modules - skipping offline installation" | ||
| fi | ||
| EOC | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.