Expo EAS: How to link eas update branch with build channel? - expo

I have an expo (v 46.0.0) project with EAS with the following build config (eas.json).
{
"cli": {
"version": ">= 1.1.0"
},
"build": {
"production": {
"channel": "production",
"env": {
"APP_ENV": "production"
},
"credentialsSource": "local"
},
"preview": {
"channel": "staging",
"env": {
"APP_ENV": "staging"
},
"credentialsSource": "local"
},
"development": {
"distribution": "internal",
"developmentClient": true,
"ios": {
"simulator": true
}
}
},
"submit": {
"production": {}
}
}
A preview build shows up in Expo as follows:
Now I used EAS Update to push some changes to the existing build with the following command: eas update --branch staging.
The update shows up in expo and it is also possible to use the Preview QR Code with Expo Go. However the changes do not populate to the preview version submitted to App Store and Play Store.
Do i need to do some additional steps to link the created update with the existing staging build?

After reading the docs, I think you have to have to think differently about branch and channel.
Channels are specified at build time and exist inside a build's native code.
and
Branches are an ordered list of updates, similar to a Git branch, which is an ordered list of commits.
With EAS Update, we can link any channel to any branch, allowing us to make different updates available to different builds.
So first you have to "publish" the update group to a branch and then you gotta link the channel to point to that branch.
I imagine it could look like
eas update --branch staging-1.0.1
eas channel:edit staging --branch staging-1.0.1
Please correct me if I'm wrong about anything here.
https://github.com/expo/eas-cli#eas-channeledit-name

This was also hard to understand for me but now I got it. Unfortunately the docs are so far not really clear.
EAS builds retrieve updates from the channel specified in eas.json. So normally for production builds you would have a channel named "production".
If you now want to run an EAS Update to distribute changes to clients you won't publish directly to a channel but instead you go a detour using branches. Because branches are linked to channels you can work with different branches (e.g. for different versions) and then you only need to change the branch-channel link to publish an update.
To change the linking between a branch and a channel you run:
eas channel:edit
In an simplified setup (like mine) you would have a git branch called production and also a channel with the same name. To publish an update you then just run:
eas update --branch production
or
eas update --auto
In the latter case EAS then sets your current git branch as the branch name, so you could check out the production branch and then run this command to publish the update.

This is not possible if you are updating from the old release channel that used classic updates to the new eas update. I asked the question on the expo discord and got an answer from the staff.

This information can be found in the docs.

Related

Use DockerImageAsset image in Asset bundling

I want to upload a local file in the repository to s3 after it has been processed by a custom docker image with AWS CDK. I don't want to make the docker image public (Its not a big restriction tho). Also, I don't want to build the image for each s3 deployment
Since I don't want to build the docker image for each bucket deployment, I have created a DockerImageAsset, and tried to give image uri as BucketDeployment's bundle property. Code is below:
const image = new DockerImageAsset(this, "cv-builder-image", {
directory: join(__dirname, "../"),
});
new BucketDeployment(this, "bucket-deployment", {
destinationBucket: bucket,
sources: [
Source.asset(join(__dirname, "../"), {
bundling: {
image: DockerImage.fromRegistry(image.imageUri),
command: [
"bash",
"-c",
'echo "heloo" >> /asset-input/cv.html && cp /asset-input/cv.html /asset-output/cv.html',
],
},
}),
],
});
DockerImageAsset is deployed fine. But it throw this during BucketDeployment's deployment
docker: invalid reference format: repository name must be lowercase
I can see the image being deployed to AWS.
Any help is appreciated. Have a nice dayy
As far as I understand - to simplify - you have a Docker image which you use to launch a utility container that just takes a file and outputs an artifact (another file).
Then you want to upload the artifact to S3 using the BucketDeployment construct.
This is a common problem when dealing with compiling apps like Java to .jar artifacts or frontend applications (React, Angular) to static output (HTML, CSS, JS) files.
The way I've approached this in the past is: Split the artifact generation as a separate step in your pipeline and THEN trigger the "cdk deploy" as a subsequent step.
You would have less headache and you control all parts of the process, including having access to the low level Docker commands like docker build ... and docker run ..., and in effect, leverage local layer caching in the best possible way. If you rely on CDK to do the bundling for you - there's a bit of magic behind the scenes that's not always obvious. I'm not saying it's impossible, it's just more "work".

Modify default build stage in CDK Pipeline

I am using AWS CDK Pipeline to deploy a simple 3-tier web application (defined with CDK as well).
The web app is inside a CodeCommit repository and I am referencing the repo in the cdk pipeline. So far so good...
Only particularity of the web app is that is composed of 3 folders and in one there is the cdk app, so when I am running the pipeline I need to cd into the folder before running the cdk commands. The structure cannot be changed. Below the code: (the 3-tier cdk app is written in Typescript, the pipeline in Python)
def __init__(self, scope: Construct, construct_id: str, **kwargs) -> None:
super().__init__(scope, construct_id, **kwargs)
repo = codecommit.Repository.from_repository_name(self, "my-3tier-app",
repository_name="my-3tier-app"
)
pipeline = CodePipeline(self, "Pipeline_test",
pipeline_name="my-3tier-app-pipeline",
synth=ShellStep("Synth",
input=CodePipelineSource.code_commit(repo, "main"),
commands=[
"cd subfolder",
"npm install",
"npx cdk synth"
],
primary_output_directory="subfolder"
)
)
This creates a pipeline with 3 stages:
Source
Build
UpdatePipeline
The Build stage is where I can see the commands I defined in the Synth and it succeeds.
But I am having an hard time understanding the UpdatePipeline.
It fails with following error: Failed to store notices in the cache: Error: ENOENT: no such file or directory, open '/root/.cdk/cache/notices.json'.
In the stage details, build action, there is the following Buildsepc:
{
"version": "0.2",
"phases": {
"install": {
"commands": [
"npm install -g aws-cdk#2"
]
},
"build": {
"commands": [
"cdk -a . deploy PipelineStack --require-approval=never --verbose"
]
}
}
}
So I assume it is failing because it is running the cdk deploy from the wrong directory, not the subfolder.
If my assumption is correct, then I have the following questions:
Is this the default build action coming from the cdk?
How can I modify this Stage so I can add an extra cd subfolder to it? I am getting errors with an add_stage to the pipeline, but maybe they are not related...
or, how can I define the subfolder globally so I don't have to insert a lot of cds
Many thanks
You almost got it - you just need to adjust your primary_output_directory to point to the cdk.out folder: primary_output_directory="subfolder/cdk.out"
For reference, the CDK Pipelines docs mention this:
The pipeline assumes that your ShellStep will produce a cdk.out directory in the root, containing the CDK cloud assembly. If your CDK project lives in a subdirectory, be sure to adjust the primaryOutputDirectory to match
You already did this, you only need to point it to the cdk.out folder and it should work.

Rebuild project with helm

Unable to start build pods for helm project with helm
I am wondering what is the best way to rebuild pods in a helm project on openshift. I am working with java S2i images on openshift 3.10 / 3.11. After updating my Java Code in my repository I would like to start builds.
Eventually I didn't find a solution to solve this problem.
For a new deployment I set a timestamp inside the metadata of the deployment config.
So my question is how to trigger new build with helm? Is there a better way as oc start build?
Based on the information in the comments, I assume you need to set the correct trigger for your OpenShift image builds. The straight-forward approach seems to be to rebuild the image on every change in the repo. Therefore you should not explicitly state the commit in the BuildConfig and set a Webhook-Trigger from your code repo. For github, add this trigger to your BuildConfig:
{
"type": "GitHub",
"github": {
"secret": "secret101"
}
}
Set your github webhook to call http://<openshift_api_host:port>/osapi/v1/namespaces/<namespace>/buildconfigs/<name>/webhooks/<secret>/github
More details can be found in the documentation:
https://docs.openshift.com/enterprise/3.0/dev_guide/builds.html#webhook-triggers
If you need to set the commit-ref explicitly in the BuildConfig, there is an alternative: You can add the ConfigChange-Trigger to your BuildConfig:
{
"type": "ConfigChange"
}
But for now, according to the documentation, you need to add a new BuildConfig each time to trigger the build:
Configuration change triggers currently only work when creating a new BuildConfig. In a future release, configuration change triggers will also be able to launch a build whenever a BuildConfig is updated.
See https://docs.openshift.com/enterprise/3.0/dev_guide/builds.html#config-change-triggers

How can I use a Command to activate livereload in reload

I'm trying to figure out what are the commands or ways to reload my browser platform on every change detected with ionic or cordova because for me this lineis not working:
ionic run browser --livereload
So I'm wondering if you know how to do that. I'm using cordova plugins by the way.
Kind regards!
You can start your app in your browser with
ionic serve
This will refresh the app after every save. There were some build changes after the ionic rc2 release, so be sure to update to the latest version. That way it will even show you a loading toast, as well as give you a nicely formatted js error whenever your app fails to launch.
To update your project to the latest build version, update your package.json
{
...
"scripts": {
"clean": "ionic-app-scripts clean",
"build": "ionic-app-scripts build",
"ionic:build": "ionic-app-scripts build",
"ionic:serve": "ionic-app-scripts serve"
},
"dependencies": {
...
},
"devDependencies": {
"#ionic/app-scripts": "0.0.47",
"typescript": "2.0.9"
}
}
You can find an example of a full package.json here: https://github.com/driftyco/ionic2-app-base
ionic serve is working fine for me.
for browser, ionic serve detect every change in code and refresh the page.
You can find some commands here:
https://ionicframework.com/docs/cli/serve/
on Cli, you may try npm run dev too. --> Runs ionic serve ( development ). it's short, concise, gets the job done most times. give it a try

Running jest tests directly in Intellij Idea/WebStorm?

I'm using jest to write tests in my ReactJS application.
So far, to run my test suite, I need to type 'npm test'.
Here's the snippet from package.npm:
"scripts": {
"test": "./node_modules/.bin/jest",
(other stuff)
},
"jest": {
"unmockedModulePathPatterns": ["<rootDir>/node_modules/react"],
"scriptPreprocessor": "<rootDir>/node_modules/babel-jest",
"testFileExtensions": [
"es6",
"js"
],
"moduleFileExtensions": [
"js",
"json",
"es6"
]
},
Is it possible to run those tests within my IDE (IDEA/WebStorm) directly, preserving the configuration? I'm not a js guy, but for example WebStrom works perfectly fine with Karma. Shouldn't this be possible with jest-cli either?
To make Jest test results shown in a tree view (like karma, etc.), a special integration is needed. WebStorm doesn't yet support Jest. Please vote for WEB-14979 to be notified on any progress.
EDIT: as of March 2017 the first version of Jest integration at WebStorm has been released.
In WebStorm 9+ You can set this up as follows:
Install Jest CLI: npm install --save-dev jest-cli
Create node run configuration with javascript file set to node_modules/.bin/jest, and application parameter to --runInBand. runInBand tells jest to run in single process, otherwise there's a port conflict when running multiple node processes in debug mode
Create some tests and run configuration in Debug mode (Ctrl-D/CMD-D). If you set breakpoints in your test or app code they should hit
It would be great though if you could click on file:line numbers in the output to go directly to the code.
app_sciences's answer is awesome, but does not work for Windows.
For windows, you can use next configuration:
Provided configuration is taken from here
For IDEA I'm using https://confluence.jetbrains.com/display/IDEADEV/Run+Configurations for that purposes. For WebStorm it seems you can add your config by yourself https://www.jetbrains.com/webstorm/help/creating-and-editing-run-debug-configurations.html . The configuration you are talking about is on the software level. If you will configure to run it via your IDE it will definitely will run within the ENV variables and paths given, you just need to add the needed global paths and the commands to run.